15

I'm planning on installing Linux on a USB drive, and I was wondering which filesystem I should use to format the drive for best performance (overall responsiveness), and life of the drive?

  • 2
    Performance is one thing. Lifetime is another. And they correlate. – Runium Jun 16 '13 at 9:11
  • What kind of USB? Do you need writes after the installation? – Nils Jun 16 '13 at 21:17
6

For installing GNU/Linux on USB key, you will obtain better results if you use a so-called Live with persistant partitions.

The main advantage of using a Live system is about hardware: A linux installation will configure everything for matching specific hardware. A live system will detect hardware at each boot process.

When using a live system, the FS (maybe cramfs, iso9660 or other read-only compressed fs) is embed in a whole binary file, containing a partition table. So the only thing to do is to put them in raw on the usb key.

Once this done, you could address de rest of your usb key as one or more partitions, than format them for copy-on-write persistant partitions. For this, I recommand ext4 because it is linux defaut and flash friendly.

More info in this answer: Debian live with persistence.

| improve this answer | |
  • Can I make changes to a live system installed like that, e.g. adding new files in /bin? – Andrei Bozantan Feb 21 at 13:47
  • @AndreiBozantan Yes, there is two way: 1. you could install (add) or delete anything in persistence partition. Of course first read-only partition won't be modified, but mounted through aufs (union filesystem), this is effective. 2. you could build your own live system by using live build and add everything you need in your debian live. look Debian live with persistence. – F. Hauri Feb 22 at 9:45
5

A filesystem called F2FS is included in Linux since 3.8 and was specifically designed for SSD drives characteristics. There are a couple of other SSD-optimized filesystems if you want to explore the issue further.

| improve this answer | |
  • 2
    Your are confusing SSD and USB drive, the latter generally being non SSD, and not optimized in the same way at all. – Totor Apr 7 '14 at 16:23
  • @Totor, while this is certainly true the f2fs filesystem according to wikipedia "takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards)". That said, I haven't yet done any further research. – Michael Krelin - hacker Jun 29 '16 at 16:59
  • 1
    @MichaelKrelin-hacker Wikipedia can also be wrong. What I am saying is that a SSD controller usually takes care of blocks mapping, mainly to offer wear levelling. It can perfectly choose to work kind of "like" a log-structured fs like F2FS. It is anyway designed to be used as a "classic" hard drive. Using F2FS with a SSD is probably redundant... – Totor Jul 1 '16 at 21:34
  • @Totor, true about wikipedia, though the Documentation/filesystems/f2fs.txt says the same. And yes, thought I still haven't read up on the details of the optimizations yet, I do think it's strange that the same fs tries to optimise both for SSD and SD cards and such. And I wouldn't go for f2fs for SSD, but the question is not about SSD. But what is "USB Drive" I don't know, I definitely didn't mean external SSD when my search landed me here ;) – Michael Krelin - hacker Jul 2 '16 at 14:20
4

Couple months ago we performed performance test at the Uni Lab and there was only one winner: Ext4. Write and Read stats were so much better than ext3 and ext2 - that's quite obvious as ext4 was developed based on those two file systems.

I don't remember the specifics exactly so can't give you any number but will defo go with EXT4.

Tests were performed on USB 2.0 - Kingston.

| improve this answer | |
  • Did you check other alternative filesystems? Just curiosity... – vonbrand Feb 22 at 19:05
3

I have opted for ext4 on a 512MB partition for /boot, i chose ext4 because its compatible with grub and it has journaling capabilities.

I then chose btrfs on about 20GB partition for the root of the filesystem /, i chose btrfs because of its COW properties, i assume this will allow even wear across the drive, also btrfs is just badass. i have lzo compression enabled in fstab, and some other "flash-friendly" options (see here)

Also at the end of the drive i have a 10GB partition in ntfs that ive mounted at /home/user/Downloads which i can access when i plug it into my other computers.

| improve this answer | |
0

BTRFS is better than all others for this. Copy On Write + Data Compression will speed up disk operation. The less data will be written the longer lifetime will be.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.