[PATCH] mkinitrd rescue mode

Jeff Layton jlayton at redhat.com
Thu Jun 2 21:47:41 UTC 2005


> On Thu, Jun 02, 2005 at 04:17:22PM -0400, Jeremy Katz wrote:
> > > This does increase the memory profile of the initramfs by about 1.5M.
> > > Isn't that memory freed after the switchroot occurs, though?
> > 
> > The impression I've gotten is that the memory isn't freed with initramfs
> > since you can't actually unmount the original rootfs.
>  
> One is expected to delete files before doing the switchroot.  Unlike a ramdisk,
> the ramfs pages are immediately reclaimed.
> 

That shouldn't be too hard to handle then -- just delete busybox and
fsck* before the switchroot. Even better would be if there were some way
to get at the initramfs (is it mountable?) after the switchroot and
clean the thing out entirely.

> > If the kernel doesn't detect your drives correctly, then how exactly
> > does this let you "repair" things?  Most problems I've had are long
> > before the driver is going to screw things up.
> 

It won't let you repair anything in that particular case, but it at
least would let you determine what the problem is. That's often very
difficult. Being able to go into rescue mode and then from there being
able to do:

dmesg | more

would be be very helpful.

> Potential uses:
> 
> o  Repairing a busted root logical volume (which can happen when snapshotting
>    the root filesystem for example -- been there, done that).
> 
> o  Shrinking filesystems, including the root filesystem.
>    The various resizers only allow for online growth.
> 
> Having a simple method to create an initramfs image that includes tools plus
> their load dependencies (pulling in shared libraries, etc.), whatever the size,
> would be a win.  One could decide what is useful locally and put it in a
> special initramfs image, e.g.,
> 
> 	/boot/initrd-$KVER-rescue.img
> 
> With a remote filesystem mount (nfs, cifs, etc.) one could have access to
> a full set of tools with a simple "mount."
> 
> Booting with grub is a simple matter of including a stanza for rescue, or
> editing the initrd line manually at the grub menu.
> 

Bill makes a good point here. This doesn't have to be something used on
every boot (though if we can clean out the initramfs then I don't see
the harm). We could potentially generate 2 initrd's -- one "normal" and
one "rescue", and then have separate grub entries for each.

If we want to go with this, it might be best to think about just
ditching nash and moving to using busybox instead. Most of the functions
that nash does could be handled by the script, and other stuff we'd need
(like switchroot) could be added to it.

-- Jeff




More information about the fedora-devel-list mailing list