The box is a HP microserver, running Ubuntu 16.04. I recently "upgraded" the boot device to a 64GB SSD. Additionally there is a 1TB SATA drive.

usually it boots up with /dev/sda1 as the primary partition (on the SSD) and /dev/sda5 as swap, and /dev/sdb1 pointing to the partition on the 1Tb HDD, that is mounted to /mnt/media0.

The problem is, it sometimes changes all that, and the SSD is now /dev/sdb1 and /dev/sdb5 and the media partition is now /dev/sda1.

This, of course, causes the swap and media mounts to fail as they are listed in /etc/fstab using their previous /dev/sd* names.

So, I have:

  1. Checked the BIOS, and it consistently lists the 64GB SSD as the first drive and the 1TB IDE as the 2nd.

  2. I tried to change /etc/fstab to reference the media drive by volume label, but that causes Ubuntu to fail on startup and put me into a recovery mode.

  3. I tried to change /etc/fstab to reference the swap, and (ext4) media partitions using UUID (as, in fact, it lists the primary partition) but I then encounter the 2nd problem I have.

When I execute the following to find the UUIDs of the various partitions...

ls /dev/disk/by-uuid

both only list the 1 entry – the primary partition's UUID. I can only see the UUID of the media partition using (on boots where it does, in fact, get assigned sdb1 obviously)

tune2fs -l /dev/sdb1

but again, if I use that UUID in /etc/fstab then Ubuntu fails to boot and goes into recovery mode.

So, my questions are:

  • Is there any way to get /dev/sda and /dev/sdb to stop swapping between drives?

  • How can I get the system to see the UUIDs of the other partitions so I can use them in fstab?

  • and/or is there any other way I can reliably get my swap and media partitions mounted?

  • Strange. I would have expected every partition/filesystem to have a UUID. – roaima Apr 30 '17 at 10:24

You could use the "disk/by-id" names in /etc/fstab, see

ls -l /dev/disk/by-id

Note that these device names may be also used in other files (initrd, grub configs). So you may update your grub config and re-recreate initrd too.

| improve this answer | |
  • Interesting. Do you have an example of how to set that fstab entry up? I've only had experience with "/dev/sd*" and "UUID=" entires in fstab. " – Chris Becke Apr 30 '17 at 10:42
  • You can simply replace, say "/dev/sda1" by "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_500GB_S2RBNXAH269511Z-part1". – rudimeier Apr 30 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.