Problem with disk device names

Ubuntu Version: 25.10

Desktop Environment GNOME

Problem Description:
I have 2 nvme volumes, let’s say A and B. If I boot from an OS installed on A I see volume A as nvme0 and B as nvme1. If instead I boot from an OS installed on B I see volume B as nvme0 and A as nvme1. How can I avoid this confusion?

Relevant System Information:
Problem does not depend from Ubuntu version, I see the same problem with 22.04, 24.04, 25.04 and 25.10 and also Lubuntu and Debian Y have installed on different partitions of the same PC.

Screenshots or Error Messages:

corrado@corrado-n7-qq-0619:~$ inxi -DPxc
Drives:
  Local Storage: total: 2.28 TiB used: 12.06 GiB (0.5%)
  ID-1: /dev/nvme0n1 vendor: Kingston model: SKC2000M8250G size: 232.89 GiB
    temp: 36.9 C
  ID-2: /dev/nvme1n1 vendor: Toshiba model: KBG40ZNV256G KIOXIA
    size: 238.47 GiB temp: 50.9 C
  ID-3: /dev/sda vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-4: /dev/sdb vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-5: /dev/sdc vendor: Toshiba model: DT01ACA100 size: 931.51 GiB
Partition:
  ID-1: / size: 31.82 GiB used: 12.05 GiB (37.9%) fs: ext4 dev: /dev/nvme0n1p7
  ID-2: /boot/efi size: 252 MiB used: 10.5 MiB (4.2%) fs: vfat
    dev: /dev/nvme0n1p1
corrado@corrado-n7-qq-0619:~$ 

corrado@corrado-n03-plucky:~$ inxi -DPxc
Drives:
  Local Storage: total: 2.28 TiB used: 11.93 GiB (0.5%)
  ID-1: /dev/nvme0n1 vendor: Toshiba model: KBG40ZNV256G KIOXIA
    size: 238.47 GiB temp: 50.9 C
  ID-2: /dev/nvme1n1 vendor: Kingston model: SKC2000M8250G size: 232.89 GiB
    temp: 36.9 C
  ID-3: /dev/sda vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-4: /dev/sdb vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-5: /dev/sdc vendor: Toshiba model: DT01ACA100 size: 931.51 GiB
Partition:
  ID-1: / size: 39.08 GiB used: 11.92 GiB (30.5%) fs: ext4 dev: /dev/nvme0n1p3
  ID-2: /boot/efi size: 252 MiB used: 10.5 MiB (4.2%) fs: vfat
    dev: /dev/nvme1n1p1
corrado@corrado-n03-plucky:~$ 


Moved to Pre-Release Discussion since 25.10 is still in active development.

Thanks.

You can not, which is why Ubuntu has never used these names for anything relevant but UUIDs everywhere, these device node names are assigned by the kernel based on when it “sees” these disks, so it is depending on boot order of partitions, on the fact how fast a controller shows up, when spinning disk are in use the speed of the initialization and spinning-up also has an impact … this has been a known problem since more than a decade and the only way to solve it is to use UUIDs, labels or part-ids, which is why there is a /dev/disk directory on your system where userspace tools like “mount” (i.e. fstab) or systemd can pick the correct device as needed.

2 Likes

nvme0 and nvme1 are assigned in the order the firmware hands the
controller IDs to the kernel. When you boot from drive A, the firmware
enumerates A first, so it becomes nvme0 and B becomes nvme1; when
you boot from B the order flips. The names are not meant to be stable.

Use the identifiers that never change:

In /etc/fstab, GRUB, crypttab, etc.
Ubuntu already uses UUIDs or PARTUUIDs by default, so nothing
breaks even though nvme0/nvme1 swap.

When you work by hand, look under /dev/disk/by-id/

ls -l /dev/disk/by-id | grep nvme

You’ll see symlinks like
nvme-KINGSTON_SKC2000_SerialNumber → ../../nvme1n1
nvme-KIOXIA_KBG40ZNV256G_SerialNumber → ../../nvme0n1
Those by-id names stay the same no matter which drive you boot from.

If you really want short, friendly names, add your own udev rule.

sudo nano /etc/udev/rules.d/80-local-nvme.rules
ENV{ID_SERIAL_SHORT}=="S5ZANRB123456", SYMLINK+="nvme_kioxia"
ENV{ID_SERIAL_SHORT}=="50026B76832E3C3D", SYMLINK+="nvme_kingston"

Then reload:

sudo udevadm control --reload && sudo udevadm trigger

You’ll have /dev/nvme_kioxia and /dev/nvme_kingston that always
point at the same hardware.

In short, you can’t force the kernel to keep nvme0/nvme1 fixed, but you
don’t need to use /dev/disk/by-id/… (or your own udev symlinks) and the
confusion goes away.

3 Likes

many thanks to everyone

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.