Linux Full Install to USB stick

Jarret B

Active Member
Staff member
There are ways to install to a USB stick from a Live Linux Operating System. A problem can arise that the Boot Loader can be installed in the wrong place. Wrong partitions can be selected and important data lost.

If you use a USB stick with Persistence you cannot access files on the USB stick from another Operating System. You cannot easily transfer files to and from the USB stick.

A full install on a USB stick will make a perfect Fix stick. On a device with Persistence the Persistence is usually a compressed file which stores all of the data on the OS which is updated from the original install files. If the Persistence file should become corrupted then all data is lost. A main issue is that a Persistent drive does not allow for a kernel update. The full install will function just like a regular installation on a hard disk. The USB stick will make the OS more portable and, of course, allow for kernel updates.

The USB stick should preferably be 32 GB or more in size to allow for a large amount of space for installing programs and storing data. The size of the Swap File will vary if you use one. Depending on your preference you can simply not use a Swap File.

I have two methods for performing the full install to a USB stick. The first is with VirtualBox and the other from Virtual Machine Manager (see the article https://www.linux.org/threads/virtualization-–-libvirt-gui.4497/#post-12528 for more info on setting up the Virtual Machine Manager).

NOTE: You can have VirtualBox and Virtual Machine Manager on the same system, but they cannot be run at the same time.

VirtuaBox

Using VirtualBox to install Linux to a USB stick it can be done from VirtualBox installed on an OS other than Linux. It is best to have a 64-bit system running VirtualBox so you can either install a 32- or 64-bit Linux OS.

Once VirtualBox is installed and you have downloaded the ISO file for the distro you want to install you can start. Also make sure you have installed the VirtualBox Extension Pack.

NOTE:
It is easiest to have your USB stick formatted as one partition. The File System can be any type, preferably FAT32. When a USB stick is first bought it is a single partition that is FAT32.

Open VirtualBox and select the ‘New’ icon to create a new virtual machine. The ‘Create Virtual Machine’ window should open and ask for the ‘Name and Operating System’. Name the machine something to remember what it is and what it is used to make. For example, I am going to use Linux Mint 19 so I will name mine ‘Linux-Mint-19-Live-USB’. The ‘Type’ and ‘Version’ should be filled in, but if they are incorrect then change them as you need. Click on the ‘Next’ button. The next screen gives you the option to specify the amount of memory to use for the virtual machine. The default should be set the minimum of the selected OS on the previous screen. The default memory allocated is usually 1 GB or 1,024 MB. Look closely at the bar showing the memory range. The value at the high end is the total RAM of the system. The left side of the bar has a green line and the right side is a red color. Keep your amount within the green portion of the bar since this is the amount of RAM not being used by the OS on the physical machine. Once you have specified a memory size click on the ‘Next’ button to continue setting up your virtual machine.

The next screen allows you to set up a hard disk, or a virtual disk, made up of a single data file for your virtual machine. Keep in mind that we want to install the OS on a USB stick and not a virtual hard disk. Click on the option ‘Do not add a virtual hard disk’ and select ‘Create’. A small window should appear to warn you that you are creating a virtual machine without a hard disk. Click ‘Continue’ to proceed.

Since we are not creating a storage file the virtual machine will take up very little space on your system. The ISO file from which the virtual machine is booting will take up the most space. The virtual machine at this point is only about 12 KB. The virtual machine works just like booting from a Live CD/DVD without requiring you to shutdown your main OS.

Now the virtual machine is created, but there are still a few settings which need to be modified and added. Right-click on the virtual machine in the left pane of VirtualBox and select ‘Settings...’.

In the left pane select ‘System’. In the right pane you can modify the memory to allocate for the virtual machine. If your system has multiple processors you can click on the ‘Processor’ tab and change the number of allocated ‘Processor(s)’ to use for the virtual machine.

Click on ‘Display’ in the left pane and you can change the amount of ‘Video Memory’, which should be changed to 128 MB. Also check the box to ‘Enable 3d Acceleration’.

In the left pane select ‘Storage’. The Optical drive is shown as ‘Empty’ so select it. On the far right is a CD with a drop down arrow. Choose it and then select ‘Choose Virtual Optical Disk File’. A file selection window will appear. Find the ISO file you downloaded and select it. The option which stated ‘Empty’ before should now show the ISO file you selected.

The next item in the left pane you want to select is ‘Network’. Adapter 1 should be set to ‘NAT Network’. Enable Adapter 2 and set it to ‘Host Only Adapter’.

Make sure your USB stick is inserted into your system. Now select ‘USB’ in the left pane. In the right pane make sure the option ‘Enable USB controller’ is checked. Select your appropriate USB Version for your system. On the right side of the window will be two icons. The lower one will let you add a new USB device. Left-click on the icon and select your USB stick. If you have multiple USB sticks inserted make sure you select the correct one.

NOTE:
If no USB devices are shown after you left-click on the icon you can easily fix the problem. You need to add your user account to the ‘vboxusers’ group then logout and back in. Once you have done this you should be able to add a USB Device to your virtual machine. If the USB Devices are still not shown then you need to re-install the Extension Pack and try again.

Click ‘OK’ in the bottom corner of the window and you should be ready to go.

Select the virtual machine in the left pane and select ‘Start’ from the upper icons. If all of your settings are correct then the virtual machine should start. If the virtual machine does not start then you should go back and check all of the settings. If any errors were reported during the starting of the virtual machine use them to determine the problem.

Once your virtual machine is running you need to click on the icon ‘Install Linux Mint’. Go through the process of installing the OS. Everything is normal as with any other install, but the Storage device may be a little different.

If an option appears to install third-party software you should not check it. You want the system on the USB stick to be as basic as possible for drivers.

When partitioning the USB flash drive the system will want to set up a swap partition. The size of the swap partition will be dependent on the amount of memory you specified when creating the Virtualbox Machine. You can change the default value if you wish.

NOTE:
By default most Linux distros will use the Logical Volume Manager to make the storage device an LVM partition. It is best to make ‘Standard Partitions’ on the USB stick.

If you have the option available you can select ‘I will configure partitioning’.

NOTE:
A Boot partition of 1024 MB would be acceptable. Use the rest of the USB stick for the Root partition unless you want to reserve space for a Swap Partition.

After all of the partitioning is done you can install the OS. Complete the process by answering a few more questions. When completed you can remove the USB stick and boot other systems with it. Be sure if the OS you installed is a 64-bit OS that you only try to boot it on 64-bit systems. A 32-bit OS should boot fine on any PC as long as the system and processor is compatible with the one you installed it from.

You may find some problems arise when creating the stick on a desktop PC and booting it from a laptop.


Virtual Machine Manager

In this example I am installing a 32-bit version of Fedora 29. Download the ISO file and place it somewhere easily accessible. Also insert your USB stick into a USB port and make sure there isn’t anything on it that you do not want erased. The stick will be formatted later.

Open Virtual Machine Manager then click on File and select ‘New Virtual Machine Manager’.
The option for ‘Local install media’ should already be selected so click on the ‘Forward’ button.

Under the option for ‘Use an ISO image:’ click on ‘Browse’ and find your ISO file. Click on the ‘Forward’ button to continue.

For the options of RAM and CPUs these are completely up to you and your system. Be aware that the amount of RAM you specify will determine the amount of a swap file is created. The settings can be overwritten when the swap file is made. Click ‘Forward’ when done.

The next option is very important. You have the option here to use hard drive space. Uncheck the option ‘Enable storage for this virtual machine’ then click ‘Forward’. If a message appears to warn about not having storage space just continue on.

Give the Virtual Machine a name such as ‘Fedora29-i386-Live-USB’. Be sure to check the box for ‘Customize configuration before install’. Click ‘Finish’.

Now the Virtual Machine settings should appear. In the left pane select ‘CPUs’. In the right pane click on the box for ‘Copy host CPU configuration’. Click ‘Apply’.

At the bottom left side click on ‘Add Hardware’. In the left pane select ‘USB Host Device’. In the right pane you need to select the USB stick you have inserted into the system. If any message appears just click ‘Yes’.

Click on ‘Begin Installation’ in the top left corner and the Virtual Machine should start.

When Fedora 29 Live starts choose ‘Start Fedora’.

NOTE:
I will not go through this installation process, but I will go to detail on partitioning the USB stick or ‘Disk’.

When you get to ‘manage the installation media’ make sure the USB stick is checked and select the option for ‘Custom’ or ‘I will configure the partitioning’. Click on ‘Done’.

If there are partitions on the stick already then click on the drop down arrow to display them. Delete all of the partitions. Change ‘LVM’ to ‘Standard Partition’ and click on ‘Click here to create the automatically’. Make changes to each partition and select ‘Update Settings’ when done. Label each partition accordingly in case you need to troubleshoot booting issues at the end of the article. Click on ‘Done’ when you are finished. ‘Accept the Changes’ when prompted.

Complete the installation as required by the distro.

When done close the Virtual Machine and use the USB stick to boot a system. Preferably it may be best to use the system you created it on and once booted perform an update.

Problems with booting a USB stick

Some distros may install better from VirtualBox or Virtual Machine Manager or vice versa. In most cases I had better luck with Virtual Machine Manager.

The only distros I have had difficulty in using were CentOS and Kali. The problem with them was not the distro but GRUB. In both cases GRUB was set to boot by using the device address of SDA1. If the system you are using the USB stick already has and internal drive then the SDA1 mapping will not work. The USB stick will attempt to boot from the primary hard disk.

To fix the issue let’s look at the /grub/grub.cfg file on the Boot partition.

NOTE:
If you did not make a Boot partition, but made one large partition, then the file is in /boot/grub/grub.cfg.

Find the entries for ‘menuentry’ and ‘submenu’ as shown in Figure 1.

Figure_01.jpg

FIGURE 1

There are two areas marked in the picture. In the file there should also be a third. These three items we will change. The hard coded entries must be changed to the disks UUID.

To find the UUID of the entries we need to open the file /etc/fstab on the USB stick Root partition. Figure 2 shows an example of a file.

Figure_02.jpg

FIGURE 2

The first underlined information is for the Root partition. The second underlined section is for the Boot partition. Make a note of the Boot UUID (b8aaa102-daf2-41e3-99d5-1b76635266d8) because this will be used in the GRUB.CFG file.

Back in the GRUB.CFG file we will look at the three lines that were marked in Figure 1. The part of the line ‘root=/dev/sda2’ will be changed to ‘root=UUID=b8aaa102-daf2-41e3-99d5-1b76635266d8’. Any lines which use ‘/dev/sda1’ should be replaced with the UUID of the Root partition. Use the UUID from your FSTAB file to replace the UUID number I used for mine. Be sure to change all three lines. See Figure 3 for the changed lines. Watch closely that you get the correct UUID for SDA1 and SDA2 correctly.

NOTE: You will need ROOT privileges to edit the GRUB.CFG file.

Figure_03.jpg

FIGURE 3

Save the GRUB.CFG file and and close your editor. You should now be able to boot from the USB stick and load you OS. One of the first things you need to do is to perform a system update after it is loaded. Be sure to update the kernel if you want. Install all required applications, but watch the free space left on the USB stick.

This process will help you make Linux more portable. If your system supports USB 3.0 then you will want to buy a USB 3.0 USB stick with high data bandwidth. The faster the USB port and stick the better performance you will get from the Linux install.

NOTE: On my Kali 64-bit install to the USB stick I have 19 GB free. I used 1 GB for the Boot partition and 28 GB for the Root partition. The Kali install used 8.5 GB of space. If you plan on installing a lot of applications you may want a USB stick larger than 32 GB.
 


Jaimie

New Member
Thanks for the information!

MODERATOR'S NOTE

Jaimie that's fine, I have undeleted this Post, thanks are always welcome :)

Wizard
 
Last edited by a moderator:

Rick

New Member
Re: Jarret B

In your article, you made mention of "virtual box" and "virtual machine". Duly noted, however, are these methods the only way of running a Linux O.S. from a pendrive? I'm experiencing major lags/buffering and to a lesser degree, freezes when trying to operate LM 19.1 via "full install" from a pendrive. You also mentioned you employ (at least) a 32Gb pendrive. I must ask if that's really necessary? I'm trying to operate LM 19.1 from a 16Gb (2.0) PNY pendrive. As far as "persistence" I believe I should have all the necessary persistence "room" on the drive for I eliminate quite a few programs I don't run from the O.S. and tend to limit installing programs. Anyways...I've noticed I've had "problems" every since I've abandoned LM 17.3, which, for me, ran beautifully from a 4Gb pendrive. Yea, got the bright idea I should upgrade. So, could there be some inherent "flaw" in trying to run either 18 series or the 19 series via a pendrive? (either live or installed) And one last thing concerning 19.1...cannot get time/date program to work properly plus, time/date does not "show up" in task bar. Just wondering if you'd had any thoughts on what I've said.

Keep Pushin'
;)Rick
 

Jarret B

Active Member
Staff member
Sorry to take so long to get back to you,
If you used the method of the Full Install then there is no 'persistence'. Persistence is a compressed file which is used to store any changes made to the OS. A Full Install has no persistence file, but the whole USB stick is used exactly like a hard disk.
If you are having lag issues then my first response is to make sure you have a USB stick that is USB 2.0 or higher so it is faster, Another issue is that Linux Mint is more memory and CPU intensive. I have had better luck with Fedora, kali and Lubuntu. Another issue can be the system you are running it on should be more than able to run the OS you have chosen. I have a system with an Atom Processor and 2 GB of RAM which can run Kali and Fedora fairly well. My other system is a dual Xeon quad core with 32 GB of RAM. On it I can run about anything with a USB 2.0 Stick or above.
Yes, the USB Stick method can be a little laggy, but once a system or program is started it should be ok. The USB sticks are slower than hard disks.
The full install is a great method for portability and making a Fix It Stick.
As far as storage size of the USB stick, I only suggest a larger one to allow for the ability to install more apps as well as use it to back up some data from a system if needed.
I hope this helps with your questions.
 
I had a usb pendrive fail on me after I did this (I was using Mint, if that makes a difference). Make sure to use a drive that you know is reliable and made by a reputable brand!
 

Rick

New Member
Sorry to take so long to get back to you,
If you used the method of the Full Install then there is no 'persistence'. Persistence is a compressed file which is used to store any changes made to the OS. A Full Install has no persistence file, but the whole USB stick is used exactly like a hard disk.
If you are having lag issues then my first response is to make sure you have a USB stick that is USB 2.0 or higher so it is faster, Another issue is that Linux Mint is more memory and CPU intensive. I have had better luck with Fedora, kali and Lubuntu. Another issue can be the system you are running it on should be more than able to run the OS you have chosen. I have a system with an Atom Processor and 2 GB of RAM which can run Kali and Fedora fairly well. My other system is a dual Xeon quad core with 32 GB of RAM. On it I can run about anything with a USB 2.0 Stick or above.
Yes, the USB Stick method can be a little laggy, but once a system or program is started it should be ok. The USB sticks are slower than hard disks.
The full install is a great method for portability and making a Fix It Stick.
As far as storage size of the USB stick, I only suggest a larger one to allow for the ability to install more apps as well as use it to back up some data from a system if needed.
I hope this helps with your questions.
REPLY: Jarret B

"If you used the method of the Full Install then there is no 'persistence'. "
Agreed.
"If you are having lag issues then my first response is to make sure you have a USB stick that is USB 2.0" I've "Installed" on both 2.0-3.0 with same outcomes. Do wish to acknowledge your advice on 2.0 or 3.0 USB speed ability. I've received so much s*^* about "it HAS to be 3.0". No it don't, but then, I'm not a self-professed "gawd" of computer skills. Understandable there is to be a small degree of lag, but just that, a small degree. What I'm experiencing is (IMO) severe. Plus, I'm aware there are other O.S's that claim to "run" (from a USB stick)better than others. I'm "experimenting"(testing--operating) puppylinux and I note a vast difference in it's "speed" as opposed to the operation of LM via a USB stick. This said, it brings up some 'differences" I noticed and wonder if certain "differences" could be applied to LM?
#1. "Puppy" operates out of/from(?) a vfat system, LM operates out of a .ext4 system. Correct me if I'm wrong....would not MSWin 8.1(HDD's O.S. -or any MSWin) recognize a vfat and therefore, perform (the LM O.S.) infinitely better? In other words...do you think , if possible, changing from .ext4 to vfat would make all the difference? See, I know MSWin(HDD's O.S.) won't "recognize" .ext formats...so I'm wondering just how MSWin "reads" LM's ext 4 and, therefore, this is the cause of lag/freezes.(???) Sorry to say, I've been trying for a few years to get a LinuxMint O.S. to run(perform) correctly when "installed" on a pendrive. I have had some, but little, encouragement and help. Some have said they are doing 'just fine" with it, but I have to ask if they are running "live" as opposed to "installed". As you know, that is a big difference. Perhaps you need to know more about what I'm trying to do, why, and what are some of the parameters I'm dealing with. If so, please respond with an inquiry outlining what you need to know. #2. An LM "install" dictates using .ext4. I apologize for
the length of this response.

Rick
 

atanere

Well-Known Member
REPLY: Jarret B

"If you used the method of the Full Install then there is no 'persistence'. "
Agreed.
"If you are having lag issues then my first response is to make sure you have a USB stick that is USB 2.0" I've "Installed" on both 2.0-3.0 with same outcomes. Do wish to acknowledge your advice on 2.0 or 3.0 USB speed ability. I've received so much s*^* about "it HAS to be 3.0". No it don't, but then, I'm not a self-professed "gawd" of computer skills. Understandable there is to be a small degree of lag, but just that, a small degree. What I'm experiencing is (IMO) severe. Plus, I'm aware there are other O.S's that claim to "run" (from a USB stick)better than others. I'm "experimenting"(testing--operating) puppylinux and I note a vast difference in it's "speed" as opposed to the operation of LM via a USB stick. This said, it brings up some 'differences" I noticed and wonder if certain "differences" could be applied to LM?
#1. "Puppy" operates out of/from(?) a vfat system, LM operates out of a .ext4 system. Correct me if I'm wrong....would not MSWin 8.1(HDD's O.S. -or any MSWin) recognize a vfat and therefore, perform (the LM O.S.) infinitely better? In other words...do you think , if possible, changing from .ext4 to vfat would make all the difference? See, I know MSWin(HDD's O.S.) won't "recognize" .ext formats...so I'm wondering just how MSWin "reads" LM's ext 4 and, therefore, this is the cause of lag/freezes.(???) Sorry to say, I've been trying for a few years to get a LinuxMint O.S. to run(perform) correctly when "installed" on a pendrive. I have had some, but little, encouragement and help. Some have said they are doing 'just fine" with it, but I have to ask if they are running "live" as opposed to "installed". As you know, that is a big difference. Perhaps you need to know more about what I'm trying to do, why, and what are some of the parameters I'm dealing with. If so, please respond with an inquiry outlining what you need to know. #2. An LM "install" dictates using .ext4. I apologize for
the length of this response.

Rick
Hi Rick. @Jarret B has a newer thread about doing full (multi-boot) installation on USB here. You might want to give it a full read, but he gives a new tip there that might help in your case...
You may be thinking that 13 GB is a lot of unused space. When I performed an install and used every bit of space I noticed that the installation slowed down immensely. If I left unused space then everything ran at a nice speed.
It's worth a shot on your next install attempt.... leave about 10-15% of the pendrive capacity as unused space, and see what happens. Maybe even a little extra, like 20-25%. Not sure what the magic ratio here might be with this tip, although maybe Jarret will be able to give more info about it.

Good luck!
 
  • Like
Reactions: Rob

Rick

New Member
RE: atanere

Once again, I must THANK YOU for your assistance. I do understand how often I've been here and how, through no fault of anyone, I can't seem to "get-it-going". I will read Jarret's "newer thread" in hopes of finding my ever-elusive "remedy". " leave about 10-15% of the pendrive capacity as unused" Well, when I installed to the 16Gb. 3.0 pendrive, the install took up 47% of the drive capacity.(???) What you quoted would require me to use a 32Gb (or larger)pendrive....which I could do, if necessary? When I had LM on that 'second partiton" (the start of this on-going thread) it had 33.5Gb. Let me ask you this, I've noticed "puppylinux" operates from a vfat file sys. Do you think, if possible, converting the ext4 to vfat might be an effective solution? Obviously, the next question is, "just what is it "puppy" does different from linuxmint in reference to booting? I've only had 1 problem w/ puppy (albeit I'm running puppy "live") since trying it out and that was a failure of the "bootup" process. Oh, and these questions are not solely for atanere, EVERYONE/ANYONE is welcome to jump-in on this thread. BTW...atanere, I request a PM with you if that would be OK. There is an "issue" I'd like to discuss that does not avail it'self to the subject of this thread.

APPRECIATED
 

atanere

Well-Known Member
RE: atanere

Once again, I must THANK YOU for your assistance. I do understand how often I've been here and how, through no fault of anyone, I can't seem to "get-it-going". I will read Jarret's "newer thread" in hopes of finding my ever-elusive "remedy". " leave about 10-15% of the pendrive capacity as unused" Well, when I installed to the 16Gb. 3.0 pendrive, the install took up 47% of the drive capacity.(???) What you quoted would require me to use a 32Gb (or larger)pendrive....which I could do, if necessary? When I had LM on that 'second partiton" (the start of this on-going thread) it had 33.5Gb. Let me ask you this, I've noticed "puppylinux" operates from a vfat file sys. Do you think, if possible, converting the ext4 to vfat might be an effective solution? Obviously, the next question is, "just what is it "puppy" does different from linuxmint in reference to booting? I've only had 1 problem w/ puppy (albeit I'm running puppy "live") since trying it out and that was a failure of the "bootup" process. Oh, and these questions are not solely for atanere, EVERYONE/ANYONE is welcome to jump-in on this thread. BTW...atanere, I request a PM with you if that would be OK. There is an "issue" I'd like to discuss that does not avail it'self to the subject of this thread.

APPRECIATED
Hi Rick. I'll start a PM to see if I can help with the "issue" you have.

On the vfat question, I don't think you can do a full Linux install that way. As you noted, Puppy is a "live" install. When installing other Linux in "live" mode to USB, those sticks are typically formatted FAT32.

On the 16GB flash drive, if you leave, say, 3GB as unpartitioned free space, that would still leave about 5GB for your installation to grow with new programs, updates, etc. The big thing is: does it solve your problems with lagging? If it does, you can always move up to a larger drive to satisfy your needs for space.

Jarret and others may offer some answers for you here, and your problem is on-topic with this thread, but if solving your trouble is going to be a long involved process (as it seems it might be)... it may be better to return to the thread you started here or perhaps to start over again with a new thread.

Cheers
 

Rick

New Member
Re; atanere(Stan?)

Yes, your probably right about the vfat. I had to look it up and it's just one of many "file systems" MSWin ignores. Yes, when I originally start an "install" the stick is formatted FAT32. The 'installation program" takes over the partition and changes it to ext4. So, I need to discover what else puppy does different from LM. And that also brings up "why does a "live" perform so much better than an "install". Maybe the "answer" is somewhere in those differences.(?) YES!!! This issue w/ "full install" has been an ongoing enigma...probably 2(+) yrs. now. And as you say...(in the PM) just have to keep with it for somewhere out there, someone may have the "answers". Oh..and...about the unused space on the pendrive; using a 3.0 16Gb pendrive--the "install" took up 7.63Gb leaving just about the same "unused" space on that same partition. I feel that unused space is sufficient for further program install or other modifications to the O.S. So, I don't think "unused" space is an issue(IDK)?)
Hey, you've been a great help. Perhaps I'll start a new thread and title it...Why doesn't a "full install" perform well from a pendrive?" As I found when using Linux...answers are always simple...finding those answers is what can drive one crazy(er).
Take It Easy!!
 

Rick

New Member
There are ways to install to a USB stick from a Live Linux Operating System. A problem can arise that the Boot Loader can be installed in the wrong place. Wrong partitions can be selected and important data lost.

If you use a USB stick with Persistence you cannot access files on the USB stick from another Operating System. You cannot easily transfer files to and from the USB stick.

A full install on a USB stick will make a perfect Fix stick. On a device with Persistence the Persistence is usually a compressed file which stores all of the data on the OS which is updated from the original install files. If the Persistence file should become corrupted then all data is lost. A main issue is that a Persistent drive does not allow for a kernel update. The full install will function just like a regular installation on a hard disk. The USB stick will make the OS more portable and, of course, allow for kernel updates.

The USB stick should preferably be 32 GB or more in size to allow for a large amount of space for installing programs and storing data. The size of the Swap File will vary if you use one. Depending on your preference you can simply not use a Swap File.

I have two methods for performing the full install to a USB stick. The first is with VirtualBox and the other from Virtual Machine Manager (see the article https://www.linux.org/threads/virtualization-–-libvirt-gui.4497/#post-12528 for more info on setting up the Virtual Machine Manager).

NOTE: You can have VirtualBox and Virtual Machine Manager on the same system, but they cannot be run at the same time.

VirtuaBox

Using VirtualBox to install Linux to a USB stick it can be done from VirtualBox installed on an OS other than Linux. It is best to have a 64-bit system running VirtualBox so you can either install a 32- or 64-bit Linux OS.

Once VirtualBox is installed and you have downloaded the ISO file for the distro you want to install you can start. Also make sure you have installed the VirtualBox Extension Pack.

NOTE: It is easiest to have your USB stick formatted as one partition. The File System can be any type, preferably FAT32. When a USB stick is first bought it is a single partition that is FAT32.

Open VirtualBox and select the ‘New’ icon to create a new virtual machine. The ‘Create Virtual Machine’ window should open and ask for the ‘Name and Operating System’. Name the machine something to remember what it is and what it is used to make. For example, I am going to use Linux Mint 19 so I will name mine ‘Linux-Mint-19-Live-USB’. The ‘Type’ and ‘Version’ should be filled in, but if they are incorrect then change them as you need. Click on the ‘Next’ button. The next screen gives you the option to specify the amount of memory to use for the virtual machine. The default should be set the minimum of the selected OS on the previous screen. The default memory allocated is usually 1 GB or 1,024 MB. Look closely at the bar showing the memory range. The value at the high end is the total RAM of the system. The left side of the bar has a green line and the right side is a red color. Keep your amount within the green portion of the bar since this is the amount of RAM not being used by the OS on the physical machine. Once you have specified a memory size click on the ‘Next’ button to continue setting up your virtual machine.

The next screen allows you to set up a hard disk, or a virtual disk, made up of a single data file for your virtual machine. Keep in mind that we want to install the OS on a USB stick and not a virtual hard disk. Click on the option ‘Do not add a virtual hard disk’ and select ‘Create’. A small window should appear to warn you that you are creating a virtual machine without a hard disk. Click ‘Continue’ to proceed.

Since we are not creating a storage file the virtual machine will take up very little space on your system. The ISO file from which the virtual machine is booting will take up the most space. The virtual machine at this point is only about 12 KB. The virtual machine works just like booting from a Live CD/DVD without requiring you to shutdown your main OS.

Now the virtual machine is created, but there are still a few settings which need to be modified and added. Right-click on the virtual machine in the left pane of VirtualBox and select ‘Settings...’.

In the left pane select ‘System’. In the right pane you can modify the memory to allocate for the virtual machine. If your system has multiple processors you can click on the ‘Processor’ tab and change the number of allocated ‘Processor(s)’ to use for the virtual machine.

Click on ‘Display’ in the left pane and you can change the amount of ‘Video Memory’, which should be changed to 128 MB. Also check the box to ‘Enable 3d Acceleration’.

In the left pane select ‘Storage’. The Optical drive is shown as ‘Empty’ so select it. On the far right is a CD with a drop down arrow. Choose it and then select ‘Choose Virtual Optical Disk File’. A file selection window will appear. Find the ISO file you downloaded and select it. The option which stated ‘Empty’ before should now show the ISO file you selected.

The next item in the left pane you want to select is ‘Network’. Adapter 1 should be set to ‘NAT Network’. Enable Adapter 2 and set it to ‘Host Only Adapter’.

Make sure your USB stick is inserted into your system. Now select ‘USB’ in the left pane. In the right pane make sure the option ‘Enable USB controller’ is checked. Select your appropriate USB Version for your system. On the right side of the window will be two icons. The lower one will let you add a new USB device. Left-click on the icon and select your USB stick. If you have multiple USB sticks inserted make sure you select the correct one.

NOTE: If no USB devices are shown after you left-click on the icon you can easily fix the problem. You need to add your user account to the ‘vboxusers’ group then logout and back in. Once you have done this you should be able to add a USB Device to your virtual machine. If the USB Devices are still not shown then you need to re-install the Extension Pack and try again.

Click ‘OK’ in the bottom corner of the window and you should be ready to go.

Select the virtual machine in the left pane and select ‘Start’ from the upper icons. If all of your settings are correct then the virtual machine should start. If the virtual machine does not start then you should go back and check all of the settings. If any errors were reported during the starting of the virtual machine use them to determine the problem.

Once your virtual machine is running you need to click on the icon ‘Install Linux Mint’. Go through the process of installing the OS. Everything is normal as with any other install, but the Storage device may be a little different.

If an option appears to install third-party software you should not check it. You want the system on the USB stick to be as basic as possible for drivers.

When partitioning the USB flash drive the system will want to set up a swap partition. The size of the swap partition will be dependent on the amount of memory you specified when creating the Virtualbox Machine. You can change the default value if you wish.

NOTE: By default most Linux distros will use the Logical Volume Manager to make the storage device an LVM partition. It is best to make ‘Standard Partitions’ on the USB stick.

If you have the option available you can select ‘I will configure partitioning’.

NOTE: A Boot partition of 1024 MB would be acceptable. Use the rest of the USB stick for the Root partition unless you want to reserve space for a Swap Partition.

After all of the partitioning is done you can install the OS. Complete the process by answering a few more questions. When completed you can remove the USB stick and boot other systems with it. Be sure if the OS you installed is a 64-bit OS that you only try to boot it on 64-bit systems. A 32-bit OS should boot fine on any PC as long as the system and processor is compatible with the one you installed it from.

You may find some problems arise when creating the stick on a desktop PC and booting it from a laptop.


Virtual Machine Manager

In this example I am installing a 32-bit version of Fedora 29. Download the ISO file and place it somewhere easily accessible. Also insert your USB stick into a USB port and make sure there isn’t anything on it that you do not want erased. The stick will be formatted later.

Open Virtual Machine Manager then click on File and select ‘New Virtual Machine Manager’.
The option for ‘Local install media’ should already be selected so click on the ‘Forward’ button.

Under the option for ‘Use an ISO image:’ click on ‘Browse’ and find your ISO file. Click on the ‘Forward’ button to continue.

For the options of RAM and CPUs these are completely up to you and your system. Be aware that the amount of RAM you specify will determine the amount of a swap file is created. The settings can be overwritten when the swap file is made. Click ‘Forward’ when done.

The next option is very important. You have the option here to use hard drive space. Uncheck the option ‘Enable storage for this virtual machine’ then click ‘Forward’. If a message appears to warn about not having storage space just continue on.

Give the Virtual Machine a name such as ‘Fedora29-i386-Live-USB’. Be sure to check the box for ‘Customize configuration before install’. Click ‘Finish’.

Now the Virtual Machine settings should appear. In the left pane select ‘CPUs’. In the right pane click on the box for ‘Copy host CPU configuration’. Click ‘Apply’.

At the bottom left side click on ‘Add Hardware’. In the left pane select ‘USB Host Device’. In the right pane you need to select the USB stick you have inserted into the system. If any message appears just click ‘Yes’.

Click on ‘Begin Installation’ in the top left corner and the Virtual Machine should start.

When Fedora 29 Live starts choose ‘Start Fedora’.

NOTE: I will not go through this installation process, but I will go to detail on partitioning the USB stick or ‘Disk’.

When you get to ‘manage the installation media’ make sure the USB stick is checked and select the option for ‘Custom’ or ‘I will configure the partitioning’. Click on ‘Done’.

If there are partitions on the stick already then click on the drop down arrow to display them. Delete all of the partitions. Change ‘LVM’ to ‘Standard Partition’ and click on ‘Click here to create the automatically’. Make changes to each partition and select ‘Update Settings’ when done. Label each partition accordingly in case you need to troubleshoot booting issues at the end of the article. Click on ‘Done’ when you are finished. ‘Accept the Changes’ when prompted.

Complete the installation as required by the distro.

When done close the Virtual Machine and use the USB stick to boot a system. Preferably it may be best to use the system you created it on and once booted perform an update.

Problems with booting a USB stick

Some distros may install better from VirtualBox or Virtual Machine Manager or vice versa. In most cases I had better luck with Virtual Machine Manager.

The only distros I have had difficulty in using were CentOS and Kali. The problem with them was not the distro but GRUB. In both cases GRUB was set to boot by using the device address of SDA1. If the system you are using the USB stick already has and internal drive then the SDA1 mapping will not work. The USB stick will attempt to boot from the primary hard disk.

To fix the issue let’s look at the /grub/grub.cfg file on the Boot partition.

NOTE: If you did not make a Boot partition, but made one large partition, then the file is in /boot/grub/grub.cfg.

Find the entries for ‘menuentry’ and ‘submenu’ as shown in Figure 1.

View attachment 3532
FIGURE 1

There are two areas marked in the picture. In the file there should also be a third. These three items we will change. The hard coded entries must be changed to the disks UUID.

To find the UUID of the entries we need to open the file /etc/fstab on the USB stick Root partition. Figure 2 shows an example of a file.

View attachment 3533
FIGURE 2

The first underlined information is for the Root partition. The second underlined section is for the Boot partition. Make a note of the Boot UUID (b8aaa102-daf2-41e3-99d5-1b76635266d8) because this will be used in the GRUB.CFG file.

Back in the GRUB.CFG file we will look at the three lines that were marked in Figure 1. The part of the line ‘root=/dev/sda2’ will be changed to ‘root=UUID=b8aaa102-daf2-41e3-99d5-1b76635266d8’. Any lines which use ‘/dev/sda1’ should be replaced with the UUID of the Root partition. Use the UUID from your FSTAB file to replace the UUID number I used for mine. Be sure to change all three lines. See Figure 3 for the changed lines. Watch closely that you get the correct UUID for SDA1 and SDA2 correctly.

NOTE: You will need ROOT privileges to edit the GRUB.CFG file.

View attachment 3534
FIGURE 3

Save the GRUB.CFG file and and close your editor. You should now be able to boot from the USB stick and load you OS. One of the first things you need to do is to perform a system update after it is loaded. Be sure to update the kernel if you want. Install all required applications, but watch the free space left on the USB stick.

This process will help you make Linux more portable. If your system supports USB 3.0 then you will want to buy a USB 3.0 USB stick with high data bandwidth. The faster the USB port and stick the better performance you will get from the Linux install.

NOTE: On my Kali 64-bit install to the USB stick I have 19 GB free. I used 1 GB for the Boot partition and 28 GB for the Root partition. The Kali install used 8.5 GB of space. If you plan on installing a lot of applications you may want a USB stick larger than 32 GB.

Jarret;

I would like to have an involved conversation with you(and your colleagues). That would be only if you choose so. It's quite possible(probable) it would be lengthy. That conversation would concern an "install" not live,(in this case-LM 19.1) on a pendrive and the many problems I'm experiencing with it performing sufficiently. Please contact me either PM or my e-mail.
Thank You;
Rick
 

Rob

Administrator
Staff member
Jarret;

I would like to have an involved conversation with you(and your colleagues). That would be only if you choose so. It's quite possible(probable) it would be lengthy. That conversation would concern an "install" not live,(in this case-LM 19.1) on a pendrive and the many problems I'm experiencing with it performing sufficiently. Please contact me either PM or my e-mail.
Thank You;
Rick
Hi Rick - sorry, but all of the people on the forum here are volunteers and are just helping out when they have time. They can't be put in a position to help someone privately 1 on 1 - it wouldn't be fair to them.

If you have a thread that you've started, please go about posting your problem there and the users that are available to help will give it a go.

Thanks!
 

Rick

New Member
Sorry to take so long to get back to you,
If you used the method of the Full Install then there is no 'persistence'. Persistence is a compressed file which is used to store any changes made to the OS. A Full Install has no persistence file, but the whole USB stick is used exactly like a hard disk.
If you are having lag issues then my first response is to make sure you have a USB stick that is USB 2.0 or higher so it is faster, Another issue is that Linux Mint is more memory and CPU intensive. I have had better luck with Fedora, kali and Lubuntu. Another issue can be the system you are running it on should be more than able to run the OS you have chosen. I have a system with an Atom Processor and 2 GB of RAM which can run Kali and Fedora fairly well. My other system is a dual Xeon quad core with 32 GB of RAM. On it I can run about anything with a USB 2.0 Stick or above.
Yes, the USB Stick method can be a little laggy, but once a system or program is started it should be ok. The USB sticks are slower than hard disks.
The full install is a great method for portability and making a Fix It Stick.
As far as storage size of the USB stick, I only suggest a larger one to allow for the ability to install more apps as well as use it to back up some data from a system if needed.
I hope this helps with your questions.
Jarret B:

Appreciate your responding. Well....no...it does not "answer" my problem(s). I've followed everything you've mentioned about "installing" to a USB drive(flashdive/pendrive/thumbdrive...etc) what I can't get figured out is how to "install" without having the lagging/freezing issues. Those "issues" have been pervasive since LM 17.3X. Just to "test" , I tried "installing" puppylinux; it performed well. One difference I noted; puppylinux operated via of a FAT32 f/s and the LM installs inevitably operate an .ext4 partition. Understandable that the FAT32 would operate better for it is a f/s MSWin recognizes. We all know MSWin ignores any .ext f/s. I've been at this a few years and have yet to figure it out. Would appreciate any effort/thoughts you may have on this particular issue and any possible causes and fix(s). Should I post all the "particulars" involving my installation(s)?
Thank You.
 

Staff online

Members online


Latest posts

Top