I have several block volumes in /dev like /dev/sds. These block volumes are located on a SAN device. Every time I restart my Ubuntu server, the device names change.
I was wondering if there is any way to fix the device names (e.g. "sds") for these devices ?
1 Answer
There is a built in solution. Use the /dev/disk/by-id link, for example -
$ ls -l /dev/disk/by-id | grep sda
lrwxrwxrwx 1 root root 9 Mar 11 21:56 ata-ST95005620AS_5YX07EY0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar 11 21:56 ata-ST95005620AS_5YX07EY0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 11 21:56 ata-ST95005620AS_5YX07EY0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 11 21:56 ata-ST95005620AS_5YX07EY0-part5 -> ../../sda5That output means /dev/disk/by-id/ata-ST95005620AS_5YX07EY0 will always be the drive that is currently "/dev/sda".