I've searched a lot over here and after reading all that all I understood is that I have to disable swap.


I first installed VirtualBox and booted from the MATE live CD (Minimal Installation). Then I installed it on my pendrive. It is USB 3.0 SanDisk Ultra 64 GB. This one.

Booting from USB

Everything went well and I have a functioning desktop.


I don't have a personal desktop to use; I have to use a shared laptop that my father uses. Dual booting will freak him out. I have tried Puppy, KNOPPIX, Tails, and Slax. Nothing worked well for me. I decided to install the whole OS onto my pendrive.

Considering I use this for basic stuff like browsing, watching videos, copying files and not too heavy stuff. How will this affect the life of my USB drive?

I've read articles saying it will kill my pendrive, about write and read cycles and how USB have less of it. So, shall I continue using it like this? If yes, then how can I maximize the life of my pendrive?

Also, I will use it for about 20 hours a week.

System Information

  Ubuntu MATE 18.04
  Intel Core i5 5th gen. processor
  64GB USB 3.0 pendrive
  47GB available disk space


I made this post 3 months ago, asking about using Ubuntu from a pendrive. My usage has increased since then, and I have tried many different OSes, currently using Kubuntu 18.04.

I've used this pendrive on 3 different machines, two laptops (Dell and a MacBook) and a desktop computer. I didn't face any issues except wifi worked properly on all the three systems. I've been using this pendrive for about 8 months and it's still working fine.

  • 2
    Possible duplicate of How do I optimize the OS for SSDs? Jul 22, 2018 at 15:08
  • 1
    @DavidFoerster Although more and more people are using SSD's these days very few are using USB Flash Drives like the OP and I hope there could be unique answers for that environment. Someone like the learned Sudodus in this area might post an answer if this question stays open. Jul 22, 2018 at 21:46
  • @WinEunuuchs2Unix: When I compare the recommendations in the answers to the two question they are mostly the same. That's why I decided to VTC as a duplicate. Jul 23, 2018 at 9:20
  • @DavidFoerster Fair enough. We are at 3 close votes already, so I posted an answer before question was closed :) Jul 23, 2018 at 10:57

4 Answers 4


To increase the lifespan of your USB stick, minimising the number of read/writes in various ways:

Disable Swap

Swapping is the process of using part of the USB stick as volatile memory. This will increase the amount of RAM available, but it will result in a high number of read/writes. It is unlikely to increase performance significantly.

Disable swap with the swapoff command:

sudo swapoff --all

Ref.: How to permanently disable swap file?

Disabling Journaling on the Filesystem

Using a journaling filesystem such as ext3 or ext4 WITHOUT a journal is an option to decrease read/writes. The obvious drawback of using a filesystem with journaling disabled is data loss as a result of an ungraceful dismount (i.e. post power failure, kernel lockup, etc.).

You can disable journaling on ext4 on an unmounted drive like this:

umount /dev/sdaX
tune4fs -O ^has_journal /dev/sdaX
e4fsck –f /dev/sdaX
sudo reboot

Check if journaling is disabled for the filesystem and the partition is mounted:

dmesg | grep EXT4

Ref.: https://foxutech.com/how-to-disable-enable-journaling/

The noatime Mount Flag

Assign the noatime mount flag to partitions residing on the USB stick by adding it to the options section of the partition in /etc/fstab.

Ref.: https://www.howtoforge.com/reducing-disk-io-by-mounting-partitions-with-noatime

Directories in RAM

Highly used directories such as /var/tmp/ and possibly /var/log can be relocated to RAM in /etc/fstab like this:

tmpfs /var/tmp tmpfs nodev,nosuid,size=50M 0 0

This will allow /var/tmp to use 50MB of RAM as disk space. The only issue with doing this is that any drives mounted in RAM will not persist past a reboot. Thus if you mount /var/log and your system encounters an error that causes it to reboot, you will not be able to find out why.

Directories in external Hard Disk

You can also mount some directories on a persistent USB hard disk.

  • I did disable swap, also set swappiness to 0. For 2nd step do I have to use another system?
    – Avizini
    Jul 22, 2018 at 9:20
  • This is my fstab file, bin.disroot.org/…
    – Avizini
    Jul 22, 2018 at 9:22
  • New fstab file after making changes, bin.disroot.org/…
    – Avizini
    Jul 22, 2018 at 9:32
  • +1 for a good answer :-) @Avizini, The following link and links from it may add some details, Boot Ubuntu from external drive. See 'Final system tweaks' at the end of the answer.
    – sudodus
    Jul 22, 2018 at 9:51

SSDs are designed for OS, Pen Drives are not

Although you can use pen drives to store and execute an Operating System (OS) they were not designed for that purpose like an SSD (Solid State Device) is. As such you will not find the manufacturer utilities such as TRIM nor Linux support such as the nvme command (Is it still bad to use swap on a modern SSD?).

Below is what wikipedia has to say about Pen Drive lifespan. Ensure you avoid the SLC type which might only last a few days.


The memory in flash drives is commonly engineered with multi-level cell (MLC) based memory that is good for around 3,000-5,000 program-erase cycles,[51] but some flash drives have single-level cell (SLC) based memory that is good for around 100,000 writes. There is virtually no limit to the number of reads from such flash memory, so a well-worn USB drive may be write-protected to help ensure the life of individual cells.

Estimation of flash memory endurance is a challenging subject that depends on the SLC/MLC/TLC memory type, size of the flash memory chips, and actual usage pattern. As a result, a USB flash drive can last from a few days to several hundred years.[52]

Regardless of the endurance of the memory itself, the USB connector hardware is specified to withstand only around 1,500 insert-removal cycles.[53]

Booting operating systems

Most current PC firmware permits booting from a USB drive, allowing the launch of an operating system from a bootable flash drive. Such a configuration is known as a Live USB.[64]

Original flash memory designs had very limited estimated lifetimes. The failure mechanism for flash memory cells is analogous to a metal fatigue mode; the device fails by refusing to write new data to specific cells that have been subject to many read-write cycles over the device's lifetime. Premature failure of a "live USB" could be circumvented by using a flash drive with a write-lock switch as a WORM device, identical to a live CD. Originally, this potential failure mode limited the use of "live USB" system to special-purpose applications or temporary tasks, such as:

  • Loading a minimal, hardened kernel for embedded applications (e.g., network router, firewall).
  • Bootstrapping an operating system install or disk cloning operation, often across a network.
  • Maintenance tasks, such as virus scanning or low-level data repair, without the primary host operating system loaded.

As of 2011, newer flash memory designs have much higher estimated lifetimes. Several manufacturers are now offering warranties of 5 years or more. Such warranties should make the device more attractive for more applications. By reducing the probability of the device's premature failure, flash memory devices can now be considered for use where a magnetic disk would normally have been required. Flash drives have also experienced an exponential growth in their storage capacity over time (following the Moore's Law growth curve). As of 2013, single-packaged devices with capacities of 1 TB are readily available,[35] and devices with 16 GB capacity are very economical. Storage capacities in this range have traditionally been considered to offer adequate space, because they allow enough space for both the operating system software and some free space for the user's data.

  • +1 It's common sense that SSDs have greater longevity than USB pen drives.
    – karel
    Jul 23, 2018 at 11:01

If you only average 20 hours a week using a bootable pendrive it should last just about forever.

Lets do the math:

A pendrive is good for between 10000 and 1000000 writes, (and infinite reads).

One write = 64GB / 0.030 GB/s = 2133 sec = 0.6 hours.

Minimum lifetime = 10000 writes x 0.6 hours / write = 16667 hours or

16667 hours / 20 hours per week = 833 weeks, (or 16 years).

Kind of seems like a waste of time to put a lot of effort into improving this.


Since I last investigated flash drive life it seems the estimate for consumer flash, (MLC), life expectancy has dropped to as low as 1000 - 10000 writes.

This makes the minimum life expectancy = 16 years / 10 = 1.6 years.

Perhaps it is worthwhile reducing writes to consumer, (cheap), MLC type flash drives.

  • I have been searching for over three years for someone that can confirm that their thumb drive was bricked running Ubuntu: askubuntu.com/questions/588035/… Jul 22, 2018 at 16:31
  • 3
    This calculation assumes that every memory cell including the most worn memory cells are written to 10000 times. Some logical memory locations will be written to many more times than the average in an installed system, so the system must have an efficient algorithm to spread the wear by remapping between the logical memory locations and the memory cells. I think this algorithm can be a weak link in the chain. -- But it is certainly true that USB pendrives last longer now, than some years ago, and that their lifetime is better than the reputation.
    – sudodus
    Jul 22, 2018 at 16:57
  • And of course a booted pendrive is only written to a small percentage of the time. I finally bricked an eleven year old 4GB Kingston DataTraveler that I have always run Ubuntu on. Bricked it using Disk Destroyer , not running Ubuntu. Jul 22, 2018 at 17:09
  • 1
    Josh did a good article on Wear Leveling back in 2008: bress.net/blog/archives/… Jul 22, 2018 at 17:36
  • 1
    @Peter Mortensen: Sandisk says all their drives use wear leveling, even Fits. forums.sandisk.com/t5/All-SanDisk-USB-Flash-Drives/… . Read somewhere else Sandisk uses dynamic leveling. Jul 22, 2018 at 20:12

I don't know how far your budget extends, but if you can afford an external USB drive, you can install your system on one. It will leave the hard drive in your father's computer completely unaffected.

  • The external USB hard drive will likely last many times longer than a pendrive
  • The external USB, while slower than an internal hard drive, will run faster than a pendrive
  • You won't have to forgo the benefits mentioned in the answer from @MatsK.

To install on an external USB drive

  1. Either create a Live DVD and insert it into the laptop's DVD drive; or create a Live USB (on your pendrive) and insert it into one of the laptop's USB slots.
  2. Reboot from your Live DVD or Live USB.
  3. As soon as the Live DVD or Live USB has successfully booted, insert your external USB drive into another of the laptop's USB slots.
  4. Install Ubuntu onto the external USB drive. When you select the installation options, do NOT choose the default target — this will change your father's laptop drive, which, you say, "will freak him out." Instead, choose "Something else", and select your USB external drive to install. Take extreme care to select the USB external drive (which will probably show up as /dev/sdc, but that depends on your setup). Also take great care NOT to install Grub onto the laptop, but instead onto your external hard drive.

Problems and questions

If you have trouble with point 2 or point 4, or you get to a stage in point 4 where are unsure if it's safe to proceed, start a thread on Ubuntu Forums where people can ask you questions about your setup and feed back to you what to do next.

Running your installation

Each time you want to run your installed Ubuntu, plug in the USB external drive and reboot. Before leaving the laptop, shut it down completely (not restart, hibernate or sleep) and remove your USB external drive.


Finally, you need to consider all-too-often-neglected backups. Whether you use a pendrive or a USB external drive, they can fail suddenly. If you have few files, you can use something like Dropbox or Google Drive.

Dual-boot hint

If you are brave, you can in fact install a dual boot on the laptop but you can hide the Grub menu so that your father is unaware of it. But you really need to know your stuff to do this safely.

  • 2
    External hard drives are connected to the computer by a USB cable, so jostling the external hard drive can cause severe drive wear and data loss unless the external hard drive is an SSD. This makes an SSD an economically viable solution for this use case compared to a spinning disk drive.
    – karel
    Jul 25, 2018 at 15:09
  • Good point, @karel. I keep my USB drives on a stable surface while using them. Jul 25, 2018 at 15:17
  • askubuntu.com/a/1058414/852249 -> I think 1 year of life is good for me. I'll buy another drive if it dies. Yeah, HDD is a good idea. I guess that will be more expensive for me, I had one which failed misreably and I lost all my data. > hide the grub menu. I'll look into this
    – Avizini
    Jul 25, 2018 at 16:06
  • and on pendrives, I trust them more. I have a hp 2.0 32gb drive which is serving me since ~2010 and still works good. It has been washed in washing machine for (i dont remember) x times. Still it works as it was before.
    – Avizini
    Jul 25, 2018 at 16:10
  • @Avizini If you wash your drives, you'll definitely prefer pen drives, ha ha! All of my hard drives have lasted years (they are still going strong), so maybe you were unlucky? In the long term, I think that a hard drive will be cheaper (you don't need a large one — on eBay, I just found a 60Gb SSD drive for £26, and a 40Gb hard drive for £10). Something for you to consider! Jul 26, 2018 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .