Have you ever been in a situation where you are wanting to mount your disk drives (USB, ATA, SATA, Firewire, etc.) by some unique identifier due to the occasional weirdness where you get the joy of what used to be your USB thumb drive -> /mnt/disk is now /mnt/disk2? If not then move on and pretend like you never stumbled across this post, if you have been scratching your head or read a convoluted solution that was driving your crazy this is your post.
The most consistent way I've found is to mount a device by the device's UUID, also known as its Universally Unique Identifier. What this alpha numeric looks like can depend on the device but I've yet to discover two devices that have the same UUID.
In the example below we'll assume we want to mount /dev/sda1 as /media/windows
Step 1 - Get the UUID of your drive by executing the following:
user@machine ~> sudo vol_id -u /dev/sda1
208861208860Z1A6
Step 2 - Add the proper line to your /etc/fstab file to property mount the partition in the future, snippet below:
# /dev/sda1
UUID=208861208860Z1A6 /media/windows ntfs defaults,umask=007,gid=46 0 1
Another example which mounts a FAT32 partition:
# dev/sda#
UUID=A123-B456 /media/fat32 vfat gid=46,umask=000 0 1
If you wish to 'reload' the fstab file instead of rebooting:
user@machine ~> mount -a
Monday, November 26, 2007
Mount Disk by UUID
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment