1

Please let me know if this question needs to be reworded; I've been reading about the lowest levels of loading for Linux and Systemd.

I'm currently dealing with a limitation in grubx64.efi - It cannot allocate an initial ram disk of 1.2 gigabytes, the size of my company's LiveCD.

My thought for a solution is to load a smaller LiveCD ramdisk first, a custom initrd of ~300 megs or so, and inside that custom initrd have it set up to load the "real" LiveCD of 1.2 gigs, mount IT as the root file system, and then remove the old one.

I've been educating myself on how Systemd and the Linux boot process works in an attempt to figure out exactly how I might execute on this transition in CentOS 7, but the exact commands to invoke and places to put edits aren't obvious to me.

Is this something that can even be done manually?

  • You use the terms "initramfs" and "initrd" (or "ramdisk") interchangeably, which is incorrect. A ramdisk has to be allocated, and has a fixed size. A ramfs (or tmpfs) however, is constrained only by available memory. See superuser.com/questions/211071/… and kernel.org/doc/Documentation/filesystems/… – sawdust Dec 29 '17 at 2:40
  • Thanks for the comment @sawdust. My understanding is that modern initrd's, especially ones for LiveCDs, are actually just initial ram file systems labeled as "initrd.img". Is a CentOS LiveCD's initrd.img an actual ramdisk? This is why I refer to a "custom initrd". – Locane Dec 29 '17 at 2:48
0

After some back and forth with the Grub mailing list, I discovered that you can mount a squashfs image from a remote server using kernel parameters.

I set up legacy and EFI PXE to use the kernel and initrd in the PXEBOOT directory of the CentOS 7.4 ISO (kernel 3.10.0-693). Combined, they are like 60 megs or something.

Then, I put the squashfs.img file from the root file system I wanted to actually use in an http accessible directory on the same server.

Then, I used 2 kernel parameters (shown to me by the mailing list) to have the CentOS kernel mount the squashfs image as the root file system; the kernel is smart enough to know that live: means and creates a temporary (and very fragile - haven't figured that part out yet; 1 gig of writes causes it to go read-only) file system in RAM with which to do basic read/writing. I added these parameters to the PXE menu entry:

rootfstype=auto root=live:http://path/to/squashfs.img

That was it. That was the magic I was missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.