Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Confusion between sda4 and sdb4
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
CPUFan
n00b
n00b


Joined: 21 May 2015
Posts: 58

PostPosted: Thu May 28, 2015 6:22 pm    Post subject: Confusion between sda4 and sdb4 Reply with quote

Hi,

I've installed gentoo like in the handbook. For configuring the kernel, I used the "make menuconfig" method, not genkernel. Afterwards, everything went fine.

After a while, I've updated my kernel (reinstalled it and re-configured GRUB). Since then, after booting, I get a kernel error most of the time (sometimes not). I pressed "e" after booting and changed root=/dev/sda4 to root=/dev/sdb4, and then it worked. Somehow, my hard disk is sometimes sda, and sometimes sdb (sda is an usb device in this case).

How do I best configure GRUB to boot my hard disk, no matter whether it will be sda or sdb?

Thanks on advance.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43210
Location: 56N 3W

PostPosted: Thu May 28, 2015 6:32 pm    Post subject: Reply with quote

CPUFan,

Welcome to Gentoo.

In your grub command line you can use the PARTUUID for root.
Run blkid and you will see something like
Code:
$ sudo  blkid
/dev/sda1: UUID="9392926d-6408-6e7a-8663-82834138a597" TYPE="linux_raid_member" PARTUUID="0553caf4-01"
/dev/sda2: UUID="b6633d8e-41ef-4485-9bbe-c4c2d69f4e8c" TYPE="swap" PARTUUID="0553caf4-02"

The UUID is a property of the filesystem
The PARTUUID is a property of the partition.

If you use an initrd, you may write root=UUID=9392926d-6408-6e7a-8663-82834138a597 in your bootloader config.
Where you use the UUID of your sda4

Without a initrd, you can use root=PARTUUID=0553caf4-01
Which is not quite so robust.
If you use a GPT formatted HDD, the PARTUUIDs will be much longer and therefore much more likely to be unique.

The kernel can use PARTUUID without any help but it needs the userspace mount command to find filesystem UUIDs.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
CPUFan
n00b
n00b


Joined: 21 May 2015
Posts: 58

PostPosted: Thu May 28, 2015 7:05 pm    Post subject: Reply with quote

Thanks, NeddySeagoon,

I get what you mean, but now I have 2 more questions:

  • Why did grub2-mkconfig not set root to the UUID, but use the more unstable sda4 instead?
  • Your solution will help if I press "e" on booting each time. Can I also configure grub to do this automatically? It looks like I'd have to edit /boot/grub/grub.cfg, though this file asks me to look into /etc/grub.d/10_linux. Should I go in there and change the
    Code:
    root=${...}
    line to
    Code:
    root=UUID=...
    ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43210
Location: 56N 3W

PostPosted: Thu May 28, 2015 7:12 pm    Post subject: Reply with quote

CPUFan,

I have newer used grub2, so I'll pass on the why.
Yes you can set up grub2 to do it automatically but I don't use it, so I can't help with the how.

Your suggested solution looks promising. If it fails, you will either need to use a liveCD or the 'e' key to pick up the pieces.
Do you feel lucky ?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
CPUFan
n00b
n00b


Joined: 21 May 2015
Posts: 58

PostPosted: Fri May 29, 2015 4:24 pm    Post subject: Reply with quote

Hey,

it worked! :lol:

About the "why grub does not use UUID, but sda4 instead" by default... Maybe, if you copy your system to a new hard disk, you'd have to change the UUID, and some users might not want that. So this might be one explanation.
Back to top
View user's profile Send private message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Fri May 29, 2015 6:03 pm    Post subject: Re: Confusion between sda4 and sdb4 Reply with quote

CPUFan wrote:

After a while, I've updated my kernel (reinstalled it and re-configured GRUB). Since then, after booting, I get a kernel error most of the time (sometimes not). I pressed "e" after booting and changed root=/dev/sda4 to root=/dev/sdb4, and then it worked. Somehow, my hard disk is sometimes sda, and sometimes sdb (sda is an usb device in this case).


Just a note, having a USB hard drive or thumb drive plugged in can change this order in some BIOS implementations.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum