How to set up smartphones and PCs. Informational portal
  • home
  • Advice
  • Installing Linux on a USB stick. Installing Ubuntu LINUX from a USB stick - instruction

Installing Linux on a USB stick. Installing Ubuntu LINUX from a USB stick - instruction

A bootable flash drive with Linux Mint may be needed to install the system on a computer or to get acquainted with it in Live mode. First, you need to go from our website, and then follow the simple sequence of actions that is described in this article.

Creating a bootable USB flash drive from Windows

If you have Windows 7, 8 or 10 installed on your computer, then you need to download a special program. Here you need to build on the ultimate goals and where you will install the system. If you have new computers with UEFI, then you need to download the Rufus program. If you have older hardware, the UNetbootin program will suffice. Let's look at the nuances of working with each of the programs.

Creating a bootable Linux Mint USB stick with Rufus

Connect the USB flash drive to your computer, delete all information from it and run the Rufus program. The following window will appear in front of you:

First, specify the path to the iso image on your hard drive, and then select the "GPT for UEFI Computers" partition scheme. The rest of the program settings can be left by default and click on the "start" button. Wait until the image is written to the USB flash drive and close the program window.

Creating a bootable Linux Mint USB stick with UNetbootin

UNetbootin exists for both Windows and Linux Mint. Connect the USB flash drive to your computer, delete all information from it and run the program. The following window will appear in front of you:

Specify the path to the Linux Mint image on your computer and select the media on which this image will be recorded. Click on the "ok" button and wait for the end of the recording.

As you can see, it is very easy to write Linux Mint to a USB flash drive, and in order to boot from it, you need to set the boot priority from removable media in the BIOS. The resulting installation flash drive will be able to run not only on your computer, but also on the computers of your friends, and you can introduce them to our wonderful operating system. If you have any questions, then ask them on our.

A full-fledged operating system on a small external medium is very convenient. You can run the system on almost any computer, and also have all your files and data at hand, and you no longer need to keep a large number of systems on the main disk.

It is for these reasons that many computer users are interested in how Linux is installed on a USB flash drive, is it possible, and if possible, how to implement everything correctly. In this article we will try to answer such questions. We will also analyze in detail the installation process on a USB flash drive for one of the most popular distributions - Ubuntu.

Despite all the advantages of using an operating system from a flash drive, many say that this is not necessary. And for good reason, because such heavy use of the flash drive can simply destroy it.

Nonvolatile flash memory has one significant drawback - it is a limited number of rewrites of one cell with data. There are no restrictions on the number of data reads, and the write limit is very significant - tens of millions of times. This is not critical for using flash drives for their intended purpose, since the recording frequency there is not very high and the flash drive lasts for a long time.

But when you install the system on a USB flash drive, the kernel, the file system, programs constantly save their temporary files, constantly work with data and write something to disk, the file system journaling complicates the situation, since it logs data about any file changes to the log that further increases the number of flash drive block rewrites.

You can tell that there are SSDs made with the same technology that are used in computers. But everything is not entirely true, SSDs are designed for such a load, because they have a limit of rewrites of several billion, as well as the ability to hot swap out of order blocks with spare ones.

Therefore, when you agree to install an operating system on a USB flash drive, you should understand that the USB flash drive will work much less than it could. But it's not all bad, you can perform some optimizations that will force the system to write less information to disk. If you agree with the risk, then next we will look at how to install Linux on a USB flash drive.

Installing Linux on a USB flash drive

The Linux operating system allows the user to do whatever he needs, and if you want Linux on a flash drive, then that too is possible. We don't even have to resort to any special tools.

We will consider the whole process using Ubuntu as an example, and everything will be done using the official installer. We will not be interested in the usual recording of an image to disk or working from RAM. In the end, we will get a full-fledged operating system on a USB flash drive.

First, do everything as usual, select the language, software settings and updates. Differences begin at the stage of disk partitioning. Here you need to choose the manual option, because the automatic layout does not allow us to do what we need.

There will be one remark here, it is necessary that the system is not booted from the flash drive on which you are going to install it, otherwise you will not be able to install ubuntu on the flash drive. That is, in addition to the installer, another clean USB flash drive must be connected to the system. If everything was done correctly, then in addition to the main disk / dev / sda, the flash drive / dev / sdb will appear in the partition window:

For a flash drive, its size, disk label, and, most likely, there will be only one partition on it will be indicated. This section needs to be removed to get free space.

The first partition must be created with the FAT32 file system and exactly the first one so that Windows can work with it. For example, if you have a 16 GB flash drive, then 5-4 GB can be given for data. The mount point for this partition is / home:

The second section applies to system files, here we need at least eight gigabytes. The file system is better to take Btrfs, since we do not need journaled ext4, and btrfs has compression and optimization for ssd. Specify / as the mount point:

The last action in this step of the wizard is to specify the device for the bootloader, this should be the same flash drive on which you are installing the system.

Optimizing Ubuntu to run on a USB stick

The installation of Ubuntu on a USB flash drive is complete, but now we just need to make it work in such a way as to write data to disk at a minimum. All this needs to be done on an already installed system.

Most of the configuration will be done in the / etc / fstab file, first enable compression of all files and optimization for ssd in btrfs used as root. For the root, we used the / dev / sdb2 partition, since we used / dev / sdb1 for / home:

/ dev / sdb1 / btrfs errors = remount-ro, noatime, nodiratime, compress = lzo, ssd, commit = 60 0 1

Perhaps your disks in fstab will be named by UUID, then you will have to find the entry that specifies the mount point / and the btfs file system, and therefore change it. Consider the options:

  • errors = remount-ro- remount read-only during errors;
  • noatime- do not update the access time to files;
  • nodiratime- do not update the access time to folders;
  • compress = lzo- use lzo compression, this is the fastest zlib algorithm gives a higher compression ratio but works longer;
  • commit = 60- by default, the file system writes all information about file changes every 30 seconds to the disk, but using this parameter you can specify your own value, but no more than 300;
  • ssd- a set of optimizations for solid state drives.

Some folders in which temporary system files are most often written can be moved to RAM, for this, add the following lines to the end of the / etc / fstab file:

tmpfs / tmp tmpfs rw, size = 100m 0 0
tmpfs / run tmpfs rw 0 0
tmpfs / var / lock tmpfs rw 0 0
tmpfs / var / log tmpfs rw, size = 10m 0 0

The kernel does not immediately write data to disk, but caches it in memory, but writes it when the disk is not loaded or it can no longer be stored in memory. The files / proc / sys / vm / are used to configure the parameters for flushing data to disk. The settings below reduce the number of entries by increasing the consumption of RAM.

Maximum time between writing data to disk:

sudo sysctl -w vm.laptop_mode = 120
$ sudo sysctl -w vm.dirty_writeback_centisecs = 12000
$ sudo sysctl -w vm.dirty_expire_centisecs = 12000

The maximum amount of memory for the cache in percent:

sudo sysctl -w vm.dirty_ratio = 10

Write data to disk when only% of memory is free:

sudo sysctl -w vm.dirty_background_ratio = 1

After these settings, the installation of ubuntu on a USB flash drive is complete, the system is more or less ready for use on a USB flash drive and will not harm it so much. But still, do not forget to back up important data from time to time, because everything can break at the most inopportune moment.

It is hardly worth explaining the advantages of an operating system located on a compact removable media. It is perfect for a wide variety of purposes, and can be indispensable for advanced technicians. Running Ubuntu from a USB stick without installing is more than possible - all Linux users are well aware of this. But such a system has a minimal software package. Although the command line is supported, the functionality of the solution may be lacking. But this is not difficult to fix.

Please note that USB drives are not designed for this role. The number of rewriting cycles for them is small, and they are not very resistant to breakage. This is a price to pay for cheapness and portability. Therefore, it is not worth installing an OS on an external drive for constant and serious work. The reason is simple - any operating system constantly saves temporary data to the medium. It also logs the file system and changes. If you use a flash drive in a typical role, it will last for a long time.

IMPORTANT. It is better not to store important files on a USB flash drive. Having launched the OS, you can work with them in the cloud, or keep them on a separate drive.

You ask - what about solid state drives? The fact is that they are much more reliable. SSDs are rated to last billions of rewriting cycles. Although they work with the same technology, they include useful "self-protection" functions against wear.

The variety of Linux features is the envy of other operating systems. We don't need to use special tools to start Ubuntu from a flash drive, but rather use standard tools.

IMPORTANT. At the beginning of the OS installation to external media, make sure that the system is not currently running from it.

After that, you can proceed with the installation as you would normally - from a "desktop" operating system. The setting will be needed only at the stage of partitioning the disks. You must turn off automatic marking and choose the manual method instead. If the media is correctly identified, then in the disk selection window it should be visible as / dev / sdb (/ dev / sda is your primary disk with the installed system).


Improving the system

Installing Ubuntu on a USB stick as a full-fledged OS turned out to be quite simple, right? But that's not all. You need to make sure that the speed is acceptable and increase the lifespan of the drive. Now we will "conjure" over the system already installed on the flash drive.

First, open the following configuration file:

Enter into the command line:

/ dev / sdb1 / btrfs errors = remount-ro, noatime, nodiratime, compress = lzo, ssd, commit = 60 0 1

This is the optimal set of instructions for working with SSDs. We are "equal" to them, because OS installation on a USB flash drive is not provided initially.

You can also add settings for accessing RAM. They will help the system access the disk less often, more often using RAM for the same purposes:

$ sudo sysctl -w vm.laptop_mode = 120
$ sudo sysctl -w vm.dirty_writeback_centisecs = 12000
$ sudo sysctl -w vm.dirty_expire_centisecs = 12000

ATTENTION. Do not forget to back up your personal data on a USB flash drive more often! It will not be able to warn you before the final wear and tear of memory blocks.

Possible problems

If it is important for you to install Ubuntu on a USB flash drive as a full-fledged OS, let us remind you once again - yes, you will get the same OS as on a desktop computer. She will be stable and safe. may not suit you.

Also, beware of these issues:

  1. Do not use journaling file systems for portable drives. This will have a very bad effect on their survivability. Journaling multiplies the number of calls to the file system.
  2. It is advisable to abandon the swap partition. It also generates a huge number of memory accesses. The installer will ask you to recreate it. Give a negative answer.

IMPORTANT. If you accept the default settings, your PC will not boot without an external storage device.

conclusions

As you can see, if you have correctly installed Ubuntu on a USB flash drive, it is not difficult to use it as a full-fledged OS, it is only important that you want and have a free USB drive. Some precautions are only important at first - in the future, you can use the portable distribution just like any other. Just remember to back up your data.

Do you want to learn other Linux tricks? Then read the materials on our site, communicate with users in the comments and visit more often!

This guide will enable install Ubuntu on a USB stick and use it in Live mode. In addition, being in Live mode, you can install Ubuntu on your computer exactly as it is done when booting from an optical disc.

This makes it easy install Ubuntu on netbooks that do not have floppy drives.

First, we need to download an Ubuntu disk image.

Then - install the application "". For Windows this program can be downloaded. For Linux- it is possible in the same place, but this application is also in the repository. It will look something like this:


As shown in the image, we need to select "Diskimage" and in the dialog box find Ubuntu image file... Among the drives ("Drive"), select the one you need. I do not recommend changing the type from "USB Drive"!

By the way, you don't need to format the flash drive before this. The application will create its own next to the existing files and will work normally. If your file matches the name of the file to be installed, an action selection window will appear, which is certainly convenient.

So, installing an ISO disc image was successful - you can reboot.

During the download, select the device from which the download should be made (our flash drive). This can be done on many modern computers from the boot menu. It usually appears when you press Esc, Tab, or F8 at boot.


If this feature is not provided on your computer, you can always go into the BIOS (usually using Del / F2 / F12 at boot) - there you can configure an earlier boot of Removable devices in the Boot -> Boot Device Priority menu.

After loading, a window for selecting an action will appear. Choose "Default" - the default action.


Everyone knows that operating systems (OS) are installed on hard drives or SSDs, that is, in computer memory, but not everyone has heard of a full-fledged OS installation on a USB flash drive. With Windows, unfortunately, this will not be possible, but Linux will allow you to do your plan.

This type of installation has its own characteristics - both positive and negative. For example, having a full-fledged OS on a flash drive, you can work in it absolutely on any computer. Due to the fact that this is not a Live image of the distribution, as many might think, the files will not disappear after the session ends. The disadvantages include the fact that the performance of such an OS can be an order of magnitude lower - it all depends on the choice of the distribution kit and the correctness of the settings.

Step 1: preparatory activities

For the most part, installation on a USB flash drive is not much different from installation on a computer, for example, in advance you just need to prepare a boot disk or USB flash drive with the recorded Linux image. By the way, the article will use the Ubuntu distribution, the image of which is written to a USB flash drive, but the instructions are common for all distributions.

Please note that you need to have two flash drives - one from 4 GB of memory, and the other from 8 GB. An OS image (4 GB) will be recorded on one of them, and the OS (8 GB) will be installed on the second.

Step 2: select a priority drive in BIOS

After the bootable Ubuntu USB drive has been created, you need to insert it into your computer and launch it from the drive. This procedure may differ on different BIOS versions, but the key points are common to all.

Step 3: start installation

As soon as you boot from the USB flash drive on which the Linux image is recorded, you can immediately start installing the OS on the second USB flash drive, which at this stage must be inserted into the PC.

To start the installation, you need:

  1. On the desktop, double-click on the shortcut Install Ubuntu.
  2. Select installer language. It is recommended to choose Russian so that the names do not differ from those used in this manual. After selecting, press the button "Continue"
  3. At the second stage of installation, it is advisable to check both boxes and click "Continue"... However, if you do not have an Internet connection, then these settings will not work. They can be carried out after the installation of the system on the disk is completed with the Internet connected.
  4. Note: after clicking "Continue", the system will recommend that you remove the second media, but this is absolutely impossible - click the "No" button.

  5. It remains only to choose the type of installation. In our case choose "Another variant" and press "Continue".
  6. After all of the above, it is necessary to work with disk space, however, since this procedure includes many nuances, especially when Linux is installed on a USB flash drive, we will place it in a separate part of the article.

    Step 4: partition the disk

    Now in front of you is the disk layout window. Initially, you need to determine the USB flash drive on which Linux will be installed. This can be done in two ways: by the file system and by the size of the disk. To make it even easier to understand this, evaluate these two parameters at once. Usually, flash drives use the FAT32 file system, and the size can be found by the corresponding inscription on the device case.

    In this example, we have only one carrier defined - sda... For the purposes of this article, we will take it for a flash drive. In your case, you need to perform actions only with the section that you defined as a USB flash drive, so as not to damage or delete files from others.

    Most likely, if you have not previously deleted partitions from the flash drive, it will have only one - sda1... Since we will have to reformat the media, we need to delete this partition so that "free place"... To delete a section, press the button with the sign «-» .

    Now instead of the section sda1 the inscription appeared "free place"... From this point on, you can start marking this space. In total, we will need to create two partitions: home and system.

    Creating a home section

    Highlight first "free place" and click on the plus (+) ... A window will appear "Create section", in which you need to define five variables: size, type of partition, its location, type of file system and mount point.

    Here you need to go through each of the points separately.

    1. The size... You can set it at your discretion, but you need to take into account some factors. The bottom line is that after creating the home partition, you need to still have free space for the system one. Please note that the system partition takes about 4-5 GB of memory. So, if you have a 16 GB flash drive, then the recommended size for your home partition is about 8 - 10 GB.
    2. Section type. Since we are installing the OS on a USB flash drive, you can choose "Primary", although there is not much difference between them. Boolean is most often used in advanced sections on its own, but this is a topic for a separate article, so choose "Primary" and move on.
    3. Location of the new section... Choose "The beginning of this space", since it is desirable that the home partition be at the beginning of the occupied space. By the way, you can observe the location of this or that section on a special strip located above the section table.
    4. Use as. This is where the differences from a traditional Linux installation begin. Since a flash drive is used as a drive, not a hard disk, we need to select from the drop-down list "Journaled file system EXT2"... It is necessary for only one reason - you can easily turn off the same logging in it, so that the overwriting of the "left" data takes place less often, thereby ensuring long-term performance of the flash drive.
    5. Mount point... Since it is necessary to create a home section, in the corresponding drop-down list you need to select or register manually "/ Home".

    Finally, click the button "OK"... You should end up with something like the image below:

    Creating a system partition

    Now you need to create a second partition - the system one. This is done in almost the same way as with the previous one, but there are some differences. For example, you must select the root mount point - «/» ... And in the input field "Memory"- indicate the rest. The minimum size should be around 4000-5000 MB. The rest of the variables must be set in the same way as for the home section.

    As a result, you should get something like this:

    Important: after the markup, you should specify the location of the boot loader. This can be done in the corresponding drop-down list: "Device for installing the boot loader." In it, you need to select the USB flash drive on which you are installing Linux. It is important to select the drive itself, not its partition. In this case, it is "/ dev / sda".

    After the done manipulations, you can safely press the button Install Now... A window will appear in front of you with all the operations that will be carried out.

    Note: it is possible that after pressing the button a message will appear that the swap partition has not been created. Pay no attention to this. This section is not needed, since the installation is performed on a flash drive.

    If the parameters are similar, then feel free to click "Continue" if you notice a difference - click "Return" and change everything according to the instructions.

    Step 5: completing the installation

    The rest of the setup is no different from the classic setup (on PC), but it's worth highlighting that too.

    Time zone selection

    After partitioning the disk, you will be taken to the next window, where you will need to specify your time zone. This is only important for the correct display of the time in the system. If you do not want to waste time installing it or were unable to determine your region, then you can safely press "Continue", this operation can be performed after installation.

    Choosing a keyboard layout

    On the next screen, you need to select a keyboard layout. Everything is simple here: there are two lists in front of you, in the left one you need to select directly layout language (1), and in the second it variations (2)... You can also check the keyboard layout itself in the specially designated for this input field (3).

    After determining, press the button "Continue".

    User data entry

    At this stage, you must specify the following data:

    1. Your name- it is displayed when you log in and will serve as a guide if you need to choose between two users.
    2. Computer name- you can think of anything, but it is important to remember it, since you will have to deal with this information while working with system files and "Terminal".
    3. Username is your nickname. You can come up with any, however, like the name of the computer, it is worth remembering.
    4. Password- come up with a password that you will enter when logging into the system and when working with system files.

    Note: it is not necessary to invent a complex password; you can even specify a single-digit password to enter Linux OS, for example, "0".

    You can also choose: "Log in automatically" or "Require password to login"... In the second case, it is possible to encrypt the home folder so that attackers, while working at your PC, could not view the files located in it.

    After entering all the data, press the button "Continue".

    Conclusion

    After completing all the above instructions, you just have to wait until the installation of Linux on the USB flash drive is complete. Due to the specifics of the operation being carried out, this may take a long time, but you can track the whole process in the appropriate window.

    After the installation is complete, a notification will appear prompting you to restart your computer to use the full OS or continue using the LiveCD version.

Top related articles