Xubuntu on a USB flash drive – mount options to reduce writes

By CidTori

I’d like to have Ubuntu installed on a USB flash drive, that I could plug in (almost) any computer and boot from it, and that I could use (almost) normally, as if it was installed on that computer. I’d also like to have a data partition on it that could be used by (almost) any computer, mostly to store some portable apps, just in case.

My main concern is to increase the lifetime of my drive, but without making it too unstable.

To do that, I have to choose the right options in /etc/fstab for my partitions.
Currently, I’m thinking about these:

  • /: ext4, defaults,lazytime,commit=60,errors=remount-ro
  • /media/data: FAT32, defaults,lazytime,check=strict

So lazytime should be better than the often proposed noatime or the default relatime, since, as I understand it, it’s applied to creation, access and modification times, it’s POSIX compliant (contrary to relatime), and it reduces the amount of write cycles by storing times in RAM and writing them from time to time.

Combined with commit=60, it should reduce writes enough to compensate the journal of ext4, that I want to keep to have a stable system.

Do you think those options are good enough?
Do you see other options I could use to reduce writes but keep a stable system?


My current setup:

  • USB flash drive: SanDisk Ultra Fit (32 Gio)
  • OS: Xubuntu 16.04
  • installation: full install (from a Live USB built with Rufus)
  • drivers: none proprietary
  • file systems:
    • partitions:
      • 2: swap, 512 Mio, primary
      • 3: /, 24 Gio, primary, ext4, defaults,lazytime,commit=60,errors=remount-ro
      • 1: /media/data, ~3 Gio, primary, FAT32, defaults,lazytime,check=strict
      • unallocated: 0 Gio
    • RAM:
      • /tmp, tmpfs, defaults,nosuid,nodev,noexec,mode=1777
  • swap:
    • vm.swappiness=5
    • swap partition: 512 Mio, for emergency
    • zRAM
    • swap files:
      • /var/swap/hib.swp: same size as RAM, for hibernation, generated by a script at startup
      • /var/swap/opt.swp: if needed, generated by a script
  • over-provisioning:
    • built-in: ~2 Gio (apparently)
    • added: 0 Gio unallocated
  • scheduler: deadline

Source:: http://askubuntu.com/questions/870638/xubuntu-on-a-usb-flash-drive-mount-options-to-reduce-writes


Leave a Reply