10

I have installed my linux-system on a USB-stick. That works well, I can use it on different computers. I used ext4 as filesystem and ask myself it this is the best choice. Which file-system is best for USB-sticks? A good filesystem should not destroy the flash-drive too fast. Additional activities to secure data-integrity might be good (I do an daily backup). Another criterion might be higher performance.

5 Answers 5

6

The latest Linux kernels support F2FS a SSD optimized file system but it still experimental. If the system on the stick is not too critical you could try it out.

Otherwise with ext4:

  • disable the relatime flag (records access time)
  • enable TRIM (discard flag)

In general

  • use the NOOP scheduler instead of CFQ

Sample fstab

/dev/sda   /   ext4   noatime,nodiratime,discard,errors=remount-ro 0 1
1
  • The link is behind a paywall now.
    – mwcz
    Sep 24, 2019 at 17:03
5

Use EXT2 on flash drives to reduce write cycles. Every time you write to a EXT 4 drive, the journal must be updated which causes more writing. I use EXT 2 and password protect it using GParted or "Disk Utility".

I have never noticed a speed advantage with EXT 3 or 4 anyway.

3

FAT tends to be what they put on flash drives because it is the only filesystem that operates on all of the major operating systems.

NTFS tends be for people who

  1. Use Windows, and
  2. Prefer performance over safety

(FAT writes in a way that minimizes write grouping at the sacrifice of performance.)

Though it seems you are using Linux off of it. That case, ext4 is pretty much all you're gonna get out of it. It's journaling so data integrity is kept and is fairly fast and stable.

Word of advice with Linux USBs however: unless you use something like Slax or Puppy Linux, your drive isn't going to last much longer than 2, maybe 3 years.

6
  • Why will the stick last not longer?
    – Mnementh
    Dec 18, 2010 at 11:00
  • 1
    The amount of writes you do on the flash drive when using linux is almost quintupled. An average drive will last 10 years on normal use. Slax and Puppy are designed for flash drives and minimize writes whenever possible.
    – digitxp
    Dec 18, 2010 at 14:36
  • 2
    As far as I understand, on Linux, btrfs improves both performance and longevity on flash media, even the cheap non-reallocating kind found on USB sticks. Btrfs is still experimental, though some recent distributions are offering it as an option. Dec 18, 2010 at 22:32
  • @Gilles I think the experimentality of it is probably the problem.
    – digitxp
    Dec 18, 2010 at 23:41
  • 1
    I'd go for EXT4 over NTFS as tests shows superior performance for that. Also Gilles' comment is pretty old — the BTRFS is relatively stable now, plus supports transparent compression with different algorithms, so probably it is even better suited for usb sticks. Lastly, about the «quintupled writes» — enable noatime,nodiratime and move logging (i.e. /var/log) to tmpfs
    – Hi-Angel
    Jan 31, 2016 at 23:49
3

Justa Guy is correct that the journaling feature of EXT4 will increase write frequency. The best Filesystem to use in your application is EXT4, but with journaling disabled and with Matteo's suggestions as well.

An even better portability solution, depending on the size of your volume, may be to move the volume to RAM at boot then write to disk at log off. In which case I would recommend Ext4, with journaling(default) and discard. The code for this is standard on a couple pen drive specific distros so you can just find the packages and re "make". This will result in precisely one write per session with no session data remaining on the host system and a fault tolerant file system so you can recover your image when a NAND cell goes bad.

1

According to Testing Out Linux File-Systems On A USB Flash Drive, the performance of EXT4 is better than others.

1
  • Small warning: that article is 4 years old (Nov 2009) so things might have changed in the mean time Oct 27, 2013 at 13:49

You must log in to answer this question.

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