How to prevent /sda /sdb changes between boots?


I have an external hd plugged into a server. I would like that when the server was restarted it would remain as sdb, however always it changes to sda
Is there any way I fix for it always keep as sdb?

Best Regards,
Michael Voigt


For mounting purpose you could use the UUID, which is always the same for an existing partition.

See the output of blkid and put UUID="..." into your /etc/fstab instead of a /dev/sdb1



I connect an external hd to backup via rsync. A script mounts the external drive in /mnt/backup and uses the /dev/sdb1
ex: mount /dev/sdb1 /mnt/backup
It happens that when the server is restarted, with the external HD plugged in, it does not get more like sdb, but sda, losing the reference.
What do you think I can do in this case?
This external hd is not mounted at boot, but only when I run the backup script.

Best Regards,
Michael Voigt


I use 2 udev rules for this task. When my „Elements 25A2” USB disk is connected, /dev/myBackup appears and a backup script is triggered automatically:

$ cat /etc/udev/rules.d/10-meinBackup
SUBSYSTEMS=="usb", ATTRS{product}=="Elements 25A2" , SYMLINK+="meinBackup%n"
KERNEL=="sd?1",  ACTION=="add", SUBSYSTEMS=="usb", ATTRS{product}=="Elements 25A2" , RUN+="/usr/local/bin/"




another possibility is to give the backup file system a unique label, e.g. USBBACKUP:

  • For ext4: tune2fs -L USBBACKUP /dev/<currentdevicenode>1
  • For NTFS: ntfslabel /dev/<currentdevicenode>1 USBBACKUP
  • There are corresponding commands for other file systems.

Then mount the device via its laben: mount LABEL=USBBACKUP /mnt/backup

Kind regards,



Your help has given me an idea on how to solve my problem.
Just to document, I ended up using the option described by Thorsten with minor modifications.

First, I ran the command “udevadm info -a /dev/sdb” to get the information from that device.
Then build this file:

cat /etc/udev/rules.d/10-meinBackup
SUBSYSTEMS == "usb", ATTRS {product} == "TOURO Mobile", ATTRS {serial} == "21001407200023002491", SYMLINK + = "my_bkp"

And lastly I adapted my script to mount the device /dev/my_bkp

It was ball show, it worked like a glove !!!

Thanks guys, your help was essential …

Best Regards,
Michael Voigt