After Jessie -> Stretch, sda and sdb are not consistent

Kernels & Hardware, configuring network, installing services

After Jessie -> Stretch, sda and sdb are not consistent

Postby bithead » 2021-01-31 22:16

I upgraded from Jessie to Stretch yesterday (I know, better late than never...). The PC has 2 HDDs, an internal SATA drive and an external USB drive. The internal has always been sda and the USB drive sdb. After the upgrade, the initial grub menu lists the OS, and an older installation (wheezy) on sda like it's always done. Upon choosing the OS, the USB drive is seen as sda and the internal drive is seen as sdb. Per fstab it then tries to mount /dev/sda9 to /home, and /dev/sda7 and /dev/sdb1 to configured mount points. Eventually it fails at both of these and drops me into emergency mode. This did not happen when running Jessie.

The only way I've found to get a successful boot is to 1) unplug the USB drive AND 2) comment out the line in fstab referring to /dev/sdb1. Then /home and others are mounted from /dev/sda as they've always been and a normal boot occurs. After booting, I can plug in the USB drive and mount it, although it is seen as /dev/sdc even though there is no /dev/sdb in use. Obviously this is not acceptable as a solution as manual intervention is required for a successful boot.

After a successful boot without the USB drive attached, I've reinstalled grub to /dev/sda and run the update grab command, to no avail. I've checked the BIOS settings and don't see anything that would cause this confusion. Again, it appears that the internal drive is seen as /dev/sda until the OS is chosen from the initial grub menu, at which time the system sees it as /dev/sdb. I may try installing grub to /dev/sdb when all drives are attached. In the meantime, even if that solves it, I can't fathom why this is happening. Any insights are appreciated!
Last edited by bithead on 2021-02-01 00:26, edited 1 time in total.
bithead
 
Posts: 24
Joined: 2015-10-21 02:54

Re: After Jessie -> Stretch, sda and sdb are not consistent

Postby bithead » 2021-02-01 00:25

Thinking on this some more, reinstalling grub is not the answer. I am able to get a successful boot by editing fstab to mount sdX's as the system sees them. When the USB drive is present, the internal drive is seen as sdb and the USB as sda so I tell it /home is on sdb and that sda1 should be mounted where I used to mount sdb1. This works as long as the USB drive is plugged in and functional during boot. If not, then the internal drive is seen as sda so the changes in fstab fail and the system lands in emergency mode.

This still needs a solution as the drives should not be changing like this. And blaming grub now seems to be inaccurate. If I can still edit the original subject, I will do so. Something else in the system is determining which drive is sda and which is sdb, or even sdc. I need to learn how that decision is made and how to control it. Again, insights welcome! Thanks.
bithead
 
Posts: 24
Joined: 2015-10-21 02:54

Re: After Jessie -> Stretch, sda and sdb are not consistent

Postby CwF » 2021-02-01 00:52

bithead wrote:by editing fstab to mount sdX's as the system sees them

Don't do that.
You could out think your bios, disable usb as as boot option and only use a grub on the now consistent sda internal drive.
Or, only use uuid for boot drive identities in fstab.
CwF
 
Posts: 929
Joined: 2018-06-20 15:16

Re: After Jessie -> Stretch, sda and sdb are not consistent

Postby sunrat » 2021-02-01 01:52

CwF wrote:Or, only use uuid for boot drive identities in fstab.

Yes, UUIDs will remain consistent between boots, or you can use LABEL instead.
sdX can change depending on which drive is detected first. UUIDs are now default in Debian, I don't recall if that was the case in Jessie.
For example:
Code: Select all
UUID=45a5cc41-596c-4783-b066-8607f04c28a6      /              ext4    defaults,noatime 0       1
UUID=ee8c3db0-ccee-40ef-93b1-1a245e7ecb19     swap           swap    defaults,noatime 0       0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0       0

LABEL=music      /mnt/music      ext3         auto,user,rw,noatime   0    0
LABEL=GREEN-BACKUP   /mnt/green-backup   auto   noauto,user,rw,noatime   0   0


Here the first 3 are system partitions, music is a separate internal drive automounted, and GREEN-BACKUP is an external drive which is not always attached hence noauto so it won't be expected at boot..
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3419
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: After Jessie -> Stretch, sda and sdb are not consistent

Postby bithead » 2021-02-02 01:42

Thanks folks. I didn't realize that the X of sdX was assigned dynamically based on availability, although it makes sense now that I think it through. In any event, I have UUIDs working in fstab and all is well now.
bithead
 
Posts: 24
Joined: 2015-10-21 02:54


Return to System configuration

Who is online

Users browsing this forum: No registered users and 15 guests

fashionable