4 ms·
IIRC Linux has a capability to specify the root partition at some time during loading. (Probably via the bootloader params—this is where Grub comes in use.) Thi
by aasasd 5y ago
IIRC Linux has a capability to specify the root partition at some time during loading. (Probably via the bootloader params—this is where Grub comes in use.) This is helpful for booting from a ‘recovery’ floppy/cd/usb drive and into the system on the HD. But can also be used with VMs.
Moreover—the, erm, advantage of a system where you can tune the boot process in a hundred different ways is that you can do quite weird stuff. Like, have the boot ramdisk mount a network drive and then use that as the root filesystem.
- chrsig 5y ago> IIRC Linux has a capability to specify the root partition at some time during loading. (Probably via the bootloader params—this is where Grub comes in use.) This is helpful for booting from a ‘recovery’ floppy/cd/usb drive and into the system on the HD. But can also be used with VMs. you can do this, but i've always found figuring out what drive to mount to be a challenge in the grub interface. at one point in time it was the best option. these days, it's generally easier (imho) to just boot intot he livecd/usb environment, mount the volume you want to repair, and chroot into it
- adamnew123456 5y agoIn case anyone wants more detail on the internals: The initramfs is the first root filesystem a Linux system has but it resides entirely in RAM. It's initialized using an archive stored on disk, but after that point can be modified freely without touching disk at all. Very much like /tmp in distros that store /tmp in memory. initramfs is mostly for loading stuff required for booting the system. Usually these are storage related - maybe your root filesystem lives on a disk that's encrypted, backed by RAID, etc. and it requires a password or some modules that aren't baked into the main kernel image. If you include these modules/config/etc. in your initramfs and the initramfs's init (it has a distinct init from your main system, usually a shell script) knows about them then they can be used to bootstrap your root filesystem. Of course, it requires that the initramfs be stored on a filesystem whose code is baked into the kernel. ex2 is/was a popular choice, as well as the UEFI system partition (basically FAT). Both simpler filesystems that don't bloat the kernel too much. Once you've mounted a filesystem of some kind in the initramfs, you call pivot_root and the root filesystem switches from being the initramfs to being whatever filesystem the initramfs mounted. Then you can exec that filesystem's init and get the full system up. Or you could just stop in the initramfs. Usually they just contain busybox and some other system binaries so they're not practically useful, but at one point I experimented with including a Lisp there. It never ran on real hardware but I was able to boot to an SBCL REPL via QEMU, which was pretty cool. The next step was Emacs but that didn't work out for reasons I don't remember clearly. [1] https://wiki.debian.org/InitramfsDebug https://wiki.debian.org/InitramfsDebug
- checkyoursudo 5y agoIn my system (Gentoo Linux), I boot via efistub and a built-in kernel command line that points to my root partition, so you don't even need Grub technically though I think it works basically the same way. Literally just 'root=PARTUUID=$whatever' compiled into the kernel, and you can set it as any valid rootfs target as far as I know. I don't even use an initramfs or initrd. I just boot right into my root partition in a couple of seconds.