2017-02-13 12:34 GMT+01:00, Rich Freeman <ri...@gentoo.org>: > On Mon, Feb 13, 2017 at 5:53 AM, marco restelli <mreste...@gmail.com> > wrote: >> >> Could you suggest any reference about how an initramfs can help making >> it easier to identify the correct root filesystem? Does this >> functionality overlap with what grub can do, or is something >> different? >> > > The dracut references are fairly extensive, but they probably assume > that you already know about something like this. Keep in mind that on > virtually all other distros end-users aren't expected to set up their > own kernels or initramfs so there isn't a lot of general documentation > out there. And even within Gentoo a lot of people seem to avoid an > initramfs, so our own docs may not be as extensive as they could be.
Yes, indeed I have always used gentoo without an initramfs and I am now looking into it because I want to make a bootable USB. > The short version is that the kernel is very limited in what it can > take in the root= option on the command line, and grub and other > bootloaders don't do anything to ID the root filesystem other than > passing whatever root= parameter you specify (I'd be interested in any > info to the contrary). I have always generated grub.cfg files with grub-mkconfig. In some cases I see here search --no-floppy --fs-uuid --set=root <disk-UUID> linux /kernel-XYZ root=/dev/sda4 ro As far as I understand it, the first line searches the partition where the kernel is located identifying it through the UUID. Then the second line loads the kernel passing /dev/sda4 as the system root. On the bootable USB stick, with an initramfs, however I have search --no-floppy --fs-uuid --set=root <disk-UUID> linux /kernel-XYZ root=UUID=<another-disk-UUID> ro so now also the root filesystem is identified by its UUID. Based on your comment that: > Anytime you see something like root=UUID=* that is being handled by an > initramfs. I understand that this parameter is passed by the kernel to the init script inside the initramfs which then uses "busybox findfs" to translate the UUID into a device name. Is this correct? > Basically an initramfs should be viewed as an extended bootloader. > For more exotic setups they're essentially required (such as > network-based root filesystems). The trend has also been to not add > new root-finding capabilities to the kernel as the initramfs is the > preferred way of doing things. If lvm+mdadm were being built today, > I'm not sure they would make the kernel capable of directly mounting > them as root. OK. Thank you again, Marco