The One with the Thoughts of Frans

Archive for December, 2011

Mounting filesystems with fstab

If you’re just switching from Windows and you don’t like to enter passwords every time you want to access your disks, fstab is what you need. Of course it also applies to e.g. ext4 partitions that you didn’t assign a mount point during the installation of your OS, but when you’ve come that far along you probably already know this.

By far the best explanation of fstab I’ve found was on ArchWiki, so I won’t waste my time reiterating what is stated there. I’ll merely try to further clarify a few things that were less immediately obvious to myself and needed a little experimentation.

In many ways fstab is what I always wanted in Windows. For a long, long time I’ve maintained a C partition (dedicated Windows, so I could wipe it without really affecting anything), a D partition (my primary data container), and later, as I added more HDDs, I think I got up to G. There are some hacks available, like NTFS junction points, but they don’t really protect against the fundamental flaw of drive letter assignment compared to the much more sensible mechanism of mount points.

When you mount a partition manually through your GUI, by clicking on it and entering your password, it creates a temporary entry in /etc/mtab; this entry can be used to as a starting point for fstab entries. However, for more reliable partition mounting you need to use UUIDs. You can obtain this using blkid /mnt/sda1, where /mnt/sda1 should be replaced with whatever partition you want to print a UUID for. This command needs to be run as root, i.e. with su or sudo.

# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).

If you prefer to use a GUI, there are some options, but I haven’t tried any of them.

Disk Manager
http://flomertens.free.fr/disk-manager/
PySDM
http://pysdm.sourceforge.net/
fwfstab
http://www.diffingo.com/oss/fwfstab

Comments