Ubuntu – Is it normal for devices to change their device numbers


Last time I booted, my OS drive was sdc1 and my Data drive was sda1. Now they are reversed. Are they assigned randomly at boot?

Best Answer

It is normal. Usually it happens because devices get detected in a different order. They share the /dev/sd* device names, and they will change according to what you have plugged in at the time.

You can work around it in two ways:

  1. Label the partitions then mount them by label

  2. Mount them by UUID

Labelling a disk can be done with (for example)

tune2fs -L MyLabel /dev/sdxx

then use LABEL=Mylabel as the device name in /etc/fstab

Mounting can also be done by using UUID= in /etc/fstab

The UUID can be obtained by blkid, then you can put in /etc/fstab UUID=xxxxxxxxxx as device name. UUID is unique.