0

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.

2
  • sdb is not a label that you can edit
    – jsotola
    Dec 4, 2021 at 1: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. Dec 4, 2021 at 2:48

1 Answer 1

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.

6
  • 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. Dec 4, 2021 at 2: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 4, 2021 at 2: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. Dec 4, 2021 at 3: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 4, 2021 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. Dec 5, 2021 at 14:25

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.