1

For a netboot cluster, I'm creating a CentOS 6.5 root disk. The goal is to mount / read-only over NFS, and various other folders, such as /var/log, on the local disk.

Here's my first idea:

  1. On boot, a script is executed as early as possible, which checks whether the local disk needs to be initialized or not;

  2. If the disk needs initialization, the LVM volumes are created;

  3. Normal boot continues, and the partitions are mounted whenever /etc/fstab is read.

However, other than modifying /etc/inittab or /etc/rc.d/rc.sysinit, which doesn't sound quite reasonable, I can't see how to execute a script before /etc/inittab is read.

As using local disks with a netboot setup seems to be a fairly common need, I wonder whether there is other solutions to achieve this behavior?

4
  • 1
    Have you tried pulling any of the live distros apart to see how they do it, most of those do a similar behavior to allow booting from the CD/DVD.
    – shawty
    Jun 24, 2014 at 17:10
  • @shawty As far as I know, most live distros are mounting the local disk at boot time, with standard init scripts. In my case, I need to mount the disks as early as possible, so, for example, the boot log is written on the local disk and not in a tmpfs.
    – Pierre
    Jun 24, 2014 at 17:18
  • I have to admit, it's not something I've ever tried to do Pierre (Hey your a french version of me :-) ) but when you look at a lot of these live distros they seem to be able to do things like that. You might also want to have a look at gentoo the source only linux, can't think of anything else off the top of my head, but I'll be sure to put some notes on here if I do.
    – shawty
    Jun 24, 2014 at 17:23
  • Another thought, how about writing it as an init script, then numbering/naming it so that it runs before everything else as early as possible.
    – shawty
    Jun 24, 2014 at 17:24

1 Answer 1

1

You'll probably want to do what you're looking for in a custom initrd. The initrd is used getting drivers loaded, getting software RAID up and going, etc. If you look around for diskless / stateless boot tutorials I suspect you'll be able to cobble together the pieces.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .