<br><div class="gmail_quote">On Wed, Jun 17, 2009 at 5:38 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[CC'd to fedora-virt]<br>
<div class="im"><br>
On Wed, Jun 17, 2009 at 05:25:26PM -0400, Christopher Johnston wrote:<br>
> I had a question about febootstrap and a specific<br>
> use case of mine at my company where I am implementing a stateless solution<br>
> for our grid.  I wanted to be able to take the initramfs image that is spun<br>
> up out of febootstrap and put a custom linuxrc in there which will<br>
> essentially take the contents of the initramfs and copy them directly into a<br>
> tmpfs filesystem thats mounted as /sysroot then do a pivot_root into it and<br>
> then do a full execution of init.<br>
<br>
</div>I'm a bit confused why you'd want to do this, but maybe I'm missing<br>
something.  Why copy the initramfs image into a tmpfs?  The initramfs<br>
is already loaded into kernel memory at boot time and so it has all<br>
the same properties / benefits of tmpfs.<br>
<div class="im"><br>
> I have been using nash currently to do<br>
> this and I have ran into a few issue when the system boots up once init<br>
> forks off where it segfaults.  Below is my custom linuxrc:<br>
<br>
</div>I would tend to avoid using nash.  If it's possible to add bash to the<br>
image, just use bash.<br>
<br>
You might find it helpful to look at what we do in libguestfs, here:<br>
<br>
<a href="http://git.et.redhat.com/?p=libguestfs.git;a=blob;f=appliance/make.sh.in;hb=HEAD" target="_blank">http://git.et.redhat.com/?p=libguestfs.git;a=blob;f=appliance/make.sh.in;hb=HEAD</a><br>
<div><div></div><div class="h5"><br>
> #!/sbin/nash<br>
><br>
> mount -t proc /proc /proc<br>
> echo Mounting proc filesystem<br>
> echo Mounting sysfs filesystem<br>
> mount -t sysfs /sys /sys<br>
> echo Creating /dev<br>
> mount -o mode=0755 -t tmpfs /dev /dev<br>
> mkdir /dev/pts<br>
> mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts<br>
> mkdir /dev/shm<br>
> mkdir /dev/mapper<br>
> echo Creating initial device nodes<br>
> mknod /dev/null c 1 3<br>
> mknod /dev/zero c 1 5<br>
> mknod /dev/systty c 4 0<br>
> mknod /dev/tty c 5 0<br>
> mknod /dev/console c 5 1<br>
> mknod /dev/ptmx c 5 2<br>
> mknod /dev/fb c 29 0<br>
> mknod /dev/tty0 c 4 0<br>
> mknod /dev/tty1 c 4 1<br>
> mknod /dev/tty12 c 4 12<br>
> mknod /dev/ttyS0 c 4 64<br>
> mknod /dev/ttyS1 c 4 65<br>
> mknod /dev/ttyS2 c 4 66<br>
> mknod /dev/ttyS3 c 4 67<br>
> /lib/udev/console_init tty0<br>
> mkchardevs<br>
> mkblkdevs<br>
> echo Creating tmpfs filesystem<br>
> mkdir -p /sysroot<br>
> mkrootdev -t tmpfs -o defaults,ro /dev/root<br>
> mount -o mode=0755 -t tmpfs /dev/root /sysroot<br>
> mkdir -p /sysroot/proc<br>
> mkdir -p /sysroot/sys<br>
> mkdir -p /sysroot/.oldroot<br>
> echo Copying rootfs->tmpfs<br>
> cp -a bin /sysroot<br>
> cp -a dev /sysroot<br>
> cp -a etc /sysroot<br>
> cp -a home /sysroot<br>
> cp -a lib /sysroot<br>
> cp -a lib64 /sysroot<br>
> cp -a mnt /sysroot<br>
> cp -a sbin /sysroot<br>
> cp -a tmp /sysroot<br>
> cp -a usr /sysroot<br>
> cp -a var /sysroot<br>
> cp -a root /sysroot<br>
> echo Setting up the new root tmpfs filesystem<br>
> setuproot<br>
> echo Switching from rootfs to tmpfs<br>
> switchroot<br>
><br>
> -Chris<br>
<br>
</div></div>Rich.<br>
<font color="#888888"><br>
--<br>
Richard Jones, Emerging Technologies, Red Hat  <a href="http://et.redhat.com/%7Erjones%0Avirt-df" target="_blank">http://et.redhat.com/~rjones<br>
virt-df</a> lists disk usage of guests without needing to install any<br>
software inside the virtual machine.  Supports Linux and Windows.<br>
<a href="http://et.redhat.com/%7Erjones/virt-df/" target="_blank">http://et.redhat.com/~rjones/virt-df/</a></font></blockquote><div><br>Rich,<br>
<br>
The properties may be the same, but AFAIK you cannot limit the size of
rootfs so it will use all of memory.  With tmpfs you can specifiy how
large the filesystem will be to keep the root filesystem at a fixed
size.  There are also some new features/options where you can specifc
which numa node to use memory from or to interleave across.  There are
some benefits to that for our grid/hpc workloads.<br>
<br>
Now to get this going for my testing I am comfortable using rootfs (pivotroot and switchroot dont seem to work in nash).<br>
<br>
What I have done in my testing here is generate a linuxrc which I posted.  I attmpted to use bash instead of nash and have it just fork /sbin/init but that also did not work (upstarts init does not seem to work well here).<br>
<br>I looked over the script you are using here for your virtual machine, but what are you actually doing to start init so the usual RC stuff can start running?<br>
<br>
-Chris <br></div></div><br>