You are not logged in.

#1 2017-02-09 23:26:34

markus21
Member
Registered: 2015-08-28
Posts: 26

How does GRUB [and other bootlaoders] deal with changing devices?

Hey Folks,

I've always wondered how GRUB [and other bootloaders] deal with changing devices.

For example:
I install GRUB and my System on /dev/sda. Then, let's say, I use this disk as external USB drive and plug in another master HDD.
Would GRUB still load? Or do I have to change something?

And if I had to change something, what if the USB drive sometimes is /dev/sdx and another time /dev/sdy when starting the PC?

I'm wondering because GRUB uses <hd0,1> and other tags for the disks. So, when GRUB is looking for hd0,1, isn't it looking for /dev/sda1, or do I overlook something?

Offline

#2 2017-02-09 23:51:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: How does GRUB [and other bootlaoders] deal with changing devices?

markus21 wrote:

...or do I overlook something?

https://wiki.archlinux.org/index.php/Pe … ng#by-uuid


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-02-09 23:55:03

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: How does GRUB [and other bootlaoders] deal with changing devices?

That is why you use UUIDs everywhere instead of hardcoded device paths. You can tell grub to search which disk contains a partition with a given uuid so there is no need to hardcode device paths.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2017-02-10 11:53:33

markus21
Member
Registered: 2015-08-28
Posts: 26

Re: How does GRUB [and other bootlaoders] deal with changing devices?

I know about the possibility of using UUIDs for fstab. However until right now I thought GRUB just handels disks in it's own way (since it uses hd0 instead of /dev/sda, etc.). So thanks for the input.

But still: If I use a default grub config and change the device order, should it load fine?
The Wiki says: "By default grub-mkconfig determines the UUID of the root filesystem for the configuration. To disable this, uncomment GRUB_DISABLE_LINUX_UUID=true."

I know, I could check that very easily on my own, but unfortunately I don't have a running system right now.

Offline

Board footer

Powered by FluxBB