/etc/fstab mount options

Yesterday I had to rearrange my data over my hard disks and since zfs [2][3] is not yet 100% efficient in linux distros[4] I have to do all the dirty work manually…

My first question is how the hell does the stupid fstab accept the bind option. Since its man page says as much as nothing [5]

The quick and dirty way into finding out how the stupid fstab syntax works is to mount a filesystem normally as you would do via the mount command (bind,loop anything!!!) and then check the /etc/mtab file to understand the syntax! its freaking cool and easy then to copy paste the mtab directives into the fstab file and voila! no fstab related reading is necessary!

for instance or if you prefer it as an example after some mount deeds the system reports the following on the mtab


msi939 ~ # cat /etc/mtab
...
/dev/hdb1 /mnt/hdb1 reiserfs rw 0 0
/dev/sda1 /mnt/sda1 reiserfs rw,noatime 0 0
/dev/sdc1 /mnt/sdc1 ntfs rw,noatime 0 0
/dev/sdd1 /mnt/sdd1 ext3 rw,noatime 0 0
/mnt/hdb1/mirror /home/mirror none rw,bind 0 0

which in turns translates (after using UUIDs) to the following fstab:


UUID="064368f6-a696-44b3-8a84-31e47c16d7cb" none swap sw 0 0
UUID="cb0b34366-9f99-4394-8c0d-aaa9e3c7503c" /mnt/hdb1 reiserfs noatime 0 0
UUID="4aa2348-bc8a-437d-8d72-59c6c364e0b4" /mnt/sda1 reiserfs noatime 0 0
UUID="6AE34GFCE42BC8E1" /mnt/sdc1 ntfs rw,noatime 0 0
UUID="ac7asd3d-69a6-424c-bd3c-fb0ae35a813e" /mnt/sdd1 ext3 noatime 0 0
/mnt/hdb1/mirror /home/mirror none bind,defaults 0 0

(if by accident it happens of your UUIDs matching one of the above don’t worry, it ain’t a bug! I simple changed a bit the UUIDs with random keystrokes :P - If you do have a match, bear in mind that this is something really rare, so send me a mail, maybe we are meant to get acquainted :))

I hope you enjoy this fragment of knowledge, a simple thank you is sufficient :-)

Leave a Comment

Name (required)

Mail (will not be published) (required)

Website

Comment