====== HowTo set up fstab using udev ====== ===== Intro ===== I have quite a lot of external disks, usb pendrives etc.. The problem is that I never attach all of them at the same time and in the same order, so the device names are always different.. and every time is a problem to remember where is mounted what. But there is a solution: udev. ===== Disks UUIDs ===== The uuid is the name udev gives to disks, and it's unique for each disk. So, we can use it to determine which disk is attached and where to mount it.. Doing so is quite simple: \\ First, we have to determine the UUID for our disk: # udevinfo --query=all --name /dev/sdb1|grep ID_FS_UUID= E: ID_FS_UUID=00112233-4455-6677-8899-AABBCCDDEEFF now, whe know the UUID of the partition currently attached as ''/dev/sdb1'' is ''00112233-4455-6677-8899-AABBCCDDEEFF''. \\ Udev automatically creates symlinks to "real" devices in ''/dev/disk/by-uuid/**UUID**'', so we can use /dev/disk/by-uuid/00112233-4455-6677-8899-AABBCCDDEEFF to indicate univocally our partition, no matter what is it's real name. \\ So, we can say to mount our usb disk - partition 1 to ''/mnt/my_usb_disk'' simply adding the following line to ''/etc/fstab'': /dev/disk/by-uuid/00112233-4455-6677-8899-AABBCCDDEEFF /mnt/my_usb_disk auto noatime,noauto,user 0 0 Now, the partition can be mounted with a mount /mnt/my_usb_disk no matter if it is called /dev/sdb1, /dev/sdc1 or other.. **That** partition will always be mounted on **that** mount point.