0

My Lubuntu machine is changing the way it designates the hard drives every time I change /etc/fstab and reboot it. For example, if I have the definition below the /media/WD2Tb and /media/Elements4Tb drives are not mounted:

/dev/sda1   /media/Samsung2Tb1    ext4    defaults,nofail   0    0
/dev/sdb1   /media/Hitachi2Tb    ext4    defaults,nofail  0    0
/dev/sdd1   /media/WD2Tb    ext3    defaults,nofail   0    0
/dev/sdg2   /media/Hitachi3Tb    ntfs    defaults,nofail   0    0
/dev/sde2   /media/USB4Tb    ntfs    defaults,nofail   0    0
/dev/sdc1   /media/Elements4Tb    ntfs    defaults,nofail   0    0

(The first 4 drives are internally mounted. The last 2 are external USB drives).

When I look at the disks in settings I see that the WD2Tb drive is designated as /dev/sdc1, and the Elements4Tb is designated as /dev/sdd1. So I edit /etc/fstab to change it to this:

/dev/sda1   /media/Samsung2Tb1    ext4    defaults,nofail   0    0
/dev/sdb1   /media/Hitachi2Tb    ext4    defaults,nofail  0    0
/dev/sdc1   /media/WD2Tb    ext3    defaults,nofail   0    0
/dev/sdg2   /media/Hitachi3Tb    ntfs    defaults,nofail   0    0
/dev/sde2   /media/USB4Tb    ntfs    defaults,nofail   0    0
/dev/sdd1   /media/Elements4Tb    ntfs    defaults,nofail   0    0

...but after a reboot the /media/WD2Tb and /media/Elements4Tb drives are not mounted again. This time when I look at the Disks in Settings I see that the WD2Tb drive is now designated as /dev/sdd1, and the Elements4Tb is designated as /dev/sdc1 (which is how I had them defined in the first place).

I can repeat this process ad infinitum - whenever I edit fstab, revert the designations of those two drives, and reboot the designation of the drives reverts back to its previous value. If I reboot without editing fstab then the designations stay the same. So it's basically whack-a-mole.

I know that the designations are arbitrary, but I don't understand why these two drives are having their designations changed whenever I edit fstab and reboot, despite no changes being made to the hardware.

Ian M
  • 173
  • 4
    The device names are assigned based on the order they report themselves to the host operating system, so it’s natural for them to change. I would suggest using UUIDs in your fstab file to ensure the file systems are consistently mounted in the correct locations – matigo Nov 04 '21 at 15:21
  • Thanks - I'll use UUID's instead. As a matter of interest, do you know why the /dev/sd* designations were changing even when none of the hardware had changed? – Ian M Nov 04 '21 at 15:44
  • The order they are seen by the OS is determined by your hardware/firmware.. It maybe the order power was turned on, but you'll need to explore the details of your actual hardware (off-topic; eg. some drives have a random delay on power up so if multiple are turned on at the same time they don't all 'spin up' at the same time & struggle for power risking early failure) as this site is about Ubuntu OS (inc. Lubuntu). – guiverc Nov 04 '21 at 21:18
  • Yes - many thanks – Ian M Nov 05 '21 at 18:14
  • @IanM If the above link answered your question please click "Yes" in the line after "Does this answer your question?" in the light blue banner above your question. – karel Nov 06 '21 at 03:42

0 Answers0