1

I have recently installed 3 Ubuntu 20.04 nodes. In one of them the system was installed on /dev/sdb instead of /dev/sda (apparently the sda label was used by the usb stick from where I installed the OS).

I would like to, for consistency (as I will run some Ansible playbooks working with the others disks on the nodes), all my system's nodes reside on /dev/sda.

So, the questions are:

  • How do I change (if possible) an already installed system on /dev/sdb to /dev/sda?
  • How do I prevent this situation in the future by forcing the installation into /dev/sda?

PD: I have search in this for some hours... So far I have found only a few topics in the internet related to this... 1 and 2 would be my bests choices, but still I haven't found anything really usefull for this specific case.

k.Cyborg
  • 487
  • sdb is not a label that you can edit – jsotola Dec 04 '21 at 01:46
  • This is possible but it's entirely unsupported and not at all worth the risk even if you are a very experienced user. With that being said, Ainsible doesn't care about device names so there's no need worry about something that isn't at all important. – Nasir Riley Dec 04 '21 at 02:48

1 Answers1

1

You don't need to. The kernel sets up the device nodes according to the order the I/O port is enumerated in hardware. If you unplug the USB installation drive, the other drive should move to /dev/sda on reboot.

I was just messing around with formatting an external drive. The USB 3 ports apparently are enumerated prior to ther SATA ports, so the external drive kicked the system drive to /dev/sdb on boot, and it took over /dev/sda. As long as I don't boot with the external drive attached, the system drive is /dev/sda.

Brian
  • 158
  • The order in which ports are enumerated depends on the OS, release, and other things. Should and will are two different things. The question also states that sda was the USB drive so for all you know, he's already removed it. – Nasir Riley Dec 04 '21 at 02:33
  • @Nasir Riley I've been at this a long time. Drives do not get stuck on a certain letter. If the USB installation media no longer is connected, it doesn't stay /dev/sda. You have to relax a bit. Life is too short. If you don't believe me, try it. – Brian Dec 04 '21 at 02:54
  • I've used Linux and other Unix-based OS's for a long time myself and I distinctly remember drive names remaining the same after the installation media was removed. You are basing this on an assumption without accounting for many other things including what I've mentioned as well as mount points. – Nasir Riley Dec 04 '21 at 03:19
  • It can vary by system and even then maybe by device. UEFI/BIOS normally sets drive order. And it usually is in SATA port order. But many systems also promote flash drives to sda on reboot when sdf when plugged into a booted system. And then all drives move up one letter. I have had grub install then to sdb and not boot (even thought it should be using UUID), but manually boot (without flash drive) and reinstall grub resets it to sda. – oldfred Dec 04 '21 at 16:01
  • On one system, we found that enumeration started with the external SCSI port, which was unused until we attached a RAID storage unit to it. Faced with putting a boot block on an external device and having the disk with the root filesystem change names depending on what was on the external device, we learned to embrace /dev/disk/by-id naming. – Mark Plotnick Dec 05 '21 at 14:25
  • Now pretty much everything goes by UUID. Drives can and do change letters, and it's no big deal which exact device node a drive is using, because they shouldn't be mounted using the device node name, i.e. /dev/sda, but rather by UUID. $ ls -al /dev/disk/by-uuid gives all the drive UUIDs on the system, except perhaps NVME drives in a native connector, but I think they'll be in dev/disk also. – Brian Dec 05 '21 at 20:50