Linux Mint: drives’ map changing at reboot brings fstab error

block-devicefstablinuxpartition

I've set up fstab to auto mount media drives on a Linux Mint machine.
The OS is installed on a IDE/ATA Disk while 3 SATA disks hold data to share.
The BIOS has the ATA disk as first boot device.
All SATA drives are NTFS non bootable with a single partition.

When I installed the OS:
The ATA disk was seen as sda and the other drives as sdb, sdc and sdd. The problem is that every so often when I reboot, the drives are changing: sda becomes sdd, sdb becomes sda, etc… It doesn't seem to affect the OS, but obviously my fstab config sends errors.

All the drives seem fine, and none of them is ever missing.

So, question: can I force to map the drives with fixed path? I tried using Labels but it didn't seem to work.

Also, I don't know if it is abnormal and/or relevant but my ATA drive has four partitions:
– sda1 => OS
– sda2 => Empty EX4 partition, maybe concurrent OS in the future
– sda4 => Extended partition
– sda5 => Swap
– sdb4 => SATA HDD 1
– sdc1 => SATA HDD 2
– sdd1 => SATA HDD 3

Isn't there something weird? I'd have thought I would get sda1 to 4, then sdb1, sdc1, and sdd1.

Thanks for your help!

Best Answer

So, question: can I force to map the drives with fixed path? I tried using Labels but it didn't seem to work.

Use UUID:

$ ls -lF /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Sep 15 15:35 61965e0c-8aba-4207-9424-1350aa6e051e -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 15 15:35 e002a7bc-02da-47a8-ab98-1225e6ace6d5 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 15 15:35 e23cc6c4-0e57-4cbd-8036-91ea9974bab0 -> ../../sda5

# blkid
/dev/sda5: LABEL="/data" UUID="e23cc6c4-0e57-4cbd-8036-91ea9974bab0" TYPE="ext3" 
/dev/sda3: LABEL="SWAP-sda3" TYPE="swap" 
/dev/sda2: LABEL="/" UUID="61965e0c-8aba-4207-9424-1350aa6e051e" TYPE="ext3" 
/dev/sda1: LABEL="/boot" UUID="e002a7bc-02da-47a8-ab98-1225e6ace6d5" TYPE="ext3" 

and change your /etc/fstab to use persistent name:

UUID=e23cc6c4-0e57-4cbd-8036-91ea9974bab0    /data    ext3    defaults    1 2
...
Related Question