6

My new computer has two NVMe SSD chips. Both are on the motherboard (no PCIe cards involved). On one of them there's the operating system and the other is for large data storage. For that, I wrote this on /etc/fstab:

/dev/nvme1n1p1    /mnt/data    auto    defaults    0    1

However, which of them is nvme0n1p1 and which is nvme1n1p1? That's totally random, and potentially changes on every restart of my system.

Because of that fstab line, some times the right drive is mounted on /mnt/data, and some times the system drive. So to fix this, I have to manually go to fstab and change the numbers from 0 to 1 or the opposite, then

sudo umount /mnt/data

then

sudo mount -a

And that fixes the problem. But I have to do this every now and then MANUALLY. This makes it impossible to associate anything on from the data drive with startup, because I'll never know which of them will be mounted on /mnt/data.

What do you think? Where is this problem coming from?

I'm using Ubuntu 18.04.

1 Answers1

12

Thanks to guiverc for pointing out the solution. It's simply to mount using UUID and not drive path. This is the way to do it:

  1. Get the list of your drives:
$ lsblk

returns:

nvme1n1     259:0    0   1,8T  0 disk
└─nvme1n1p1 259:5    0   1,8T  0 part /mnt/data
  1. Get the UUID of the drive you're interested in:
$ sudo blkid | grep -i nvme1n1p1

Now change my fstab line from this:

/dev/nvme1n1p1    /mnt/data    auto    defaults    0    1

to this:

UUID=388f4772-1f41-4b13-9c74-9ed56c4bacc5    /mnt/data    auto    defaults    0    1

And that does it.