1

I'd like to boot Ubuntu (or edubuntu) from a USB device, and store data on the device for future use, as well as install software, drivers, etc. According to this answer, a Full Install will get better performance and allow drivers to be installed, making it a better fit for my use case over a Persistent Install.

When I was previously looking to putting Linux on a usb key, a concern was read/write cycles and unnecessarily spending them updating swap or otherwise using temporary files. The hardware I'm considering using (most of the time) would have plenty of RAM, so I'm fine with limiting myself some there.

Is there a way to do the [Ed]Ubuntu install on a flash drive that limits/reduces/eliminates frequent writes to the flash storage device?

... or is this all completely overkill? I admit I'd like the option to use slightly older hardware, and slightly older USB keys. So yes, I'm sure I could get a new flash drive for a great price on sale. I'm not looking to spend the money though. If it helps, consider a use case where an educational organization doesn't have the discretionary funds to significantly update their hardware every few years, and so I'm volunteering my time to extend the life of their resources on hand.

If it matters, the initial consideration for install is 16.04 LTS, or 18.04 LTS.

user3.1415927
  • 178
  • 1
  • 14
  • Search this site for "optimize usb" and you will have lots of suggestions to reduce unnecessary writes -- e.g. add noatime to the root filesystem, and move things like /tmp, /var/log, and browser cache to a ramdisk. The worst times for lots of writes are the initial install and big updates (the button style USBs tend to overheat and die). – ubfan1 Nov 02 '18 at 03:30

2 Answers2

1

Back in the good old days, they said a flash drive with wear leveling, was good for 10,000 writes. After doing the math this turned out to be years of use.

Nowadays they have come out with multi layer flash drive that substitute wear life for size.

A SLC flash drive is good for over 100,000 writes, which should last forever at the expense of cost.

A MLC drive should be good for 3000 - 5000 writes. Sandisk claims all their flash drives are MLC. It has been reported that Sandisk uses the same wear leveling chip for flash drives as in their SSDs

A TLC flash drive may have lots of storage but is only good for 500 - 1000 writes.

There is no limit to flash drive reads.

To limit wear on a flash drive, do not use Swap and use ext2 for the home partition or use ext4 without journaling.

Ref:

karel
  • 114,770
C.S.Cameron
  • 19,519
0

Most USB flash drives have no wear-leveling, meaning that frequent writes to a given sector of the drive can potentially exceed the write cycle count of that sector's containing block. So, it's not enough to ensure you reduce overall writes, you would need to guard against frequent writes to any given file.

There is no practical way to really reduce this - even log-structured filesystems will have certain sectors that are frequently updated. There are more exotic filesystems that may help but are a big hassle. You could mount certain areas of the drive such as /tmp using in-memory tmpfs, but this can't really be used for other frequently-written areas like /var/cache because applications still expect that to persist across reboots.

With wear-leveling such as on an SSD, frequent writes to a certain sector aren't a problem, because the drive is constantly swapping blocks around so repeatedly writing to a given logical sector will still spread the writes over the whole drive.

That said, even with no wear-leveling your drive should last quite a while - a year or two of regular use, so as long as this is a short-term install or intended only for occasional use, there is nothing to worry about.

In other cases, consider using a hard disk drive or SSD, both of which are still available in portable form factors.

thomasrutter
  • 36,774