{
  "$type": "site.standard.document",
  "canonicalUrl": "https://justingarrison.com/blog/2011-06-13-create-a-persistent-bootable-and-virtualized-linux-usb-drive-with-lili",
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreibrkyr4jpwzqgfuo6chyfpttegpbn42al7ab44dmhcciuclieqbhe"
    },
    "mimeType": "image/png",
    "size": 53273
  },
  "description": "A Linux live USB drive is normally a blank slate each time you boot it.",
  "path": "/blog/2011-06-13-create-a-persistent-bootable-and-virtualized-linux-usb-drive-with-lili",
  "publishedAt": "2011-06-13T00:00:00.000Z",
  "site": "at://did:plc:p7uix7mresfq4nfzxp3klgfa/site.standard.publication/3mmdn7mg2qm2d",
  "textContent": "A Linux live USB drive is normally a blank slate each time you boot it. You can boot it up, install programs, save files, and change settings. But, as soon as you reboot, all your changes are wiped away and you’re back to a fresh system. This can be useful, but if you want a system that picks up where you left off, you can create a live USB with persistent storage.\n\nHow Persistent Storage Works\n\nWhen you create a USB drive with persistence, you’ll allocate up to 4 GB of the USB drive for a persistent overlay file. Any changes you make to the system—for example, saving a file to your desktop, changing the settings in an application, or installing a program—will be stored in the overlay file. Whenever you boot the USB drive on any computer, your files, settings, and installed programs will be there.\n\nThis is an ideal feature if you want to keep a live Linux system on a USB drive and use on different PCs. You won’t have to set up your system up from scratch each time you boot. You don’t need persistence if you’re just using a USB drive to install Ubuntu and then running it from your hard drive afterward.\n\nThere are a few limitations. You can’t modify system files, like the kernel. You can’t perform major system upgrades. You also can’t install hardware drivers. However, you can install most applications. You can even update most installed applications, so you can be sure your persistent USB drive has the latest version of the web browser you prefer.\n\nPersistence doesn’t work with every Linux distribution. We’ve tested it with the latest versions of Ubuntu—Ubuntu 18.04 LTS and Ubuntu 19.04—and it works. It should also work with Ubuntu-based Linux distributions. In the past, we had luck with Fedora as well. Just download the appropriate ISO file and follow the instructions below.\n\nUpdate: Rufus, which we recommend for easily creating live USB drives on Windows, now supports persistent storage in its latest versions. Previous versions did not, necessitating the below process. Give Rufus a try if you’re using Windows and want to avoid the Linux command line process below.\n\nRELATED: _How to Create a Bootable Linux USB Flash Drive, the Easy Way_\n\nHow to Make a Persistent Ubuntu USB Drive on Ubuntu\n\nYou’ll need a computer already running Ubuntu to perform this process. You’ll also need a USB drive with enough storage capacity to set up persistence. We used a 16 GB drive, but an 8 GB drive would have worked as well. The bigger the drive, the more persistent storage you can have.\n\nThe grub, boot and Ubuntu partitions take up less than 2 GB. The remainder of the space on the USB drive will be used for the casper-rw and the usbdata partitions.\n\nThe casper-rw partition is used for persistent storage. For example, software you install and settings files will be stored here.\n\nThe usbdata partition will be formatted with the NTFS file system. It will be accessible to Linux, Windows, and macOS. This partition is also available from within the live Ubuntu on the USB drive. This means any files copied to the usbdata partition from another computer will be accessible to your live Ubuntu.\n\nIn other words, the usbdata partition acts as a “shared folder” between your live Ubuntu and any other computer you plug your USB drive into. That’s pretty cool.\n\nThe below screenshot shows how the resulting partitions looked on our 16 GB drive.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_25.png?trim=1,1&bg-color=000&pad=1,1\n\nAlthough a 16 GB USB drive was used for researching this article, an 8 GB drive would work just as well. It would simply have less storage.\n\nFirst, you’ll have to download the Ubuntu ISO file you want to place on the USB drive.\n\n_Note_: If you’re creating a live USB drive from a live disk, ensure Ubuntu’s Universe repository is enabled before you continue. You can do that by running the following command:\n\nSecond, the tool you’re going to use is called mkusb. It is not part of the standard Ubuntu installation. You will need to install it. To do so, enter the following three commands. The first command adds the mkusb repository so that Ubuntu knows where to install mkusb from.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_01.png?trim=1,1&bg-color=000&pad=1,1\n\nThe next command forces Ubuntu to refresh its package lists for the registered repositories.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_02.png?trim=1,1&bg-color=000&pad=1,1\n\nWe can now proceed to install the mkusb package, with this command:\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_03.png?trim=1,1&bg-color=000&pad=1,1\n\nThe mkusb program does a terrific job of identifying USB drives. That’s great, but there’s nothing like knowing for yourself. When mkusb tells you it is going to completely wipe a particular drive, you can be sure it’s the USB drive you are planning on using and not another device on your system.\n\nIn a terminal window, type the following command. The lsblk command lists the block devices on your computer. Each drive has a block device associated with it.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_04.png?trim=1,1&bg-color=000&pad=1,1\n\nThe output from lsblk will show the drives currently connected to your computer. There is one internal hard drive on this machine called sda and there is one partition on it called sda1.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_05.png?trim=1,1&bg-color=000&pad=1,1\n\nPlug in your USB drive and use the lsblk command once more. The output from lsblk will have changed. The USB drive will now be listed in the output.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_06.png?trim=1,1&bg-color=000&pad=1,1\n\nThere is a new entry called sdb in the list. It has one partition called sdb1. That’s the USB drive.\n\nIf you have more than one drive in your computer already, the name of your USB drive will be different. Regardless of how it is named, the device that was not in the previous lsblk listing must be the USB drive.\n\nOnce you know which device your USB drive is, you can launch mkusb. Press the Super (Windows) key and type “mkusb”. The mkusb icon will appear. Click the icon or press Enter.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_6a.png?trim=1,1&bg-color=000&pad=1,1\n\nA dialog will ask you whether you wish to run the dus (Do USB Stuff) version of mkusb. Click the “Yes” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_7.png?trim=1,1&bg-color=000&pad=1,1\n\nA terminal window with a black background will appear and a dialog box will prompt you for your password. Enter your password and click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_8.png?trim=1,1&bg-color=000&pad=1,1\n\nWarning: This process will wipe the contents of the USB drive!\n\nClick “OK” in the warning dialog to acknowledge you understand this.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_9.png?trim=1,1&bg-color=000&pad=1,1\n\nClick the “Install (make a boot device)” entry in the list and click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_10.png?trim=1,1&bg-color=000&pad=1,1\n\nSelect the “‘Persistent live’ – only Debian and Ubuntu” entry in the list and click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_13.png?trim=1,1&bg-color=000&pad=1,1\n\nA file browser dialog will appear. Browse to the Ubuntu ISO file you downloaded, select it, and click the green “OK” button.\n\nIn the screenshot below, we’re selecting the Ubuntu 19.04 ISO image from the Downloads folder.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_14.png?trim=1,1&bg-color=000&pad=1,1\n\nYou’ll see a list of the USB drives connected to your computer. This allows you to select the appropriate USB drive.\n\nThere was only one USB drive connected to the test machine used for this article. As we confirmed above, it is called sdb. We’ve confirmed that’s the USB drive we want to use so we can proceed with confidence. Click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_15.png?trim=1,1&bg-color=000&pad=1,1\n\nWhen the dialog shown below appears, select the “usb-pack-efi (default grub from ISO file)” entry in the list and click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_16.png?trim=1,1&bg-color=000&pad=1,1\n\nYou have one more option to choose. You can select what percentage of the storage space is for persistent storage in the casper-rw partition. The remainder will be used for the usbdata partition, which has the NTFS file system and can also be accessed from Windows PCs and Macs.\n\nIf you’re happy to have the available space on the USB drive shared equally between these two partitions, leave the slider at its default value and click the “OK” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_17.png?trim=1,1&bg-color=000&pad=1,1\n\nNow, we just have to tell mkusb that we’re happy with all of our choices and that it should proceed.\n\nTo be clear, this is the last point at which you can back out. If you’re certain you wish to proceed, select the “Go” radio button and click the “Go” button.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_18.png?trim=1,1&bg-color=000&pad=1,1\n\nA progress bar shows you how close the creation process is to completion.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_20.png?trim=1,1&bg-color=000&pad=1,1\n\nThe final stage of the creation is to flush the file system buffers to the USB drive. You are also advised to wait until you see the phrase “Work done”. That will indicate the process has completed.\n\n!https://www.howtogeek.com/wp-content/uploads/2019/05/mkusb_22.png?trim=1,1&bg-color=000&pad=1,1\n\nWhen the process has completed you will see a dialog with the phrase “Work done” highlighted in green. Click the “OK” button. If any other dialogs appear, close them by clicking on the “Quit” button.\n\n!https://www.howtogeek.com/wp-content/upload",
  "title": "How to Create a Live Ubuntu USB Drive With Persistent Storage"
}