LWN.net Logo

Re: the initrd is actually an initramfs

Re: the initrd is actually an initramfs

Posted Nov 26, 2006 0:11 UTC (Sun) by landley (guest, #6789)
In reply to: Re: the initrd is actually an initramfs by ldo
Parent article: Embedded Linux: Small Root Filesystems

The switch_root utility essentially does:

cd newroot
find / -xdev | xargs rm -rf
mount --move . /
chroot . /sbin/init

This frees up the space used by the initramfs by deleting all the files
before switching to the new root device. (With ramfs, deleting the file
frees the memory.)

The reason you can't do this in a shell script is after the "rm -rf" step,
the shell script hasn't got a "mount" command to run anymore...


(Log in to post comments)

Re: the initrd is actually an initramfs

Posted Nov 27, 2006 6:24 UTC (Mon) by ldo (subscriber, #40946) [Link]

Of course, you wouldn't need a special boot-time utility for this, you could do the cleanup at your leisure afterwards, if only something like this were permissible:

mount -t rootfs rootfs /mnt

But this appears to be ruled out by the NOUSER flag...

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds