[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] UnionFS and initramfs



I've never played much with unionfs, but I have done a bit of initrd
tinkering to get ocfs2 working with diskless xen nodes sharing a common
xen install.

There's a few reasons why its easier to leave modular support only for
file systems you need to boot .. the biggest one (in the case of ocfs2
and others) is that the init scripts and controls that come stock with
them want to be able to load and unload modules to function.

The most efficient way to do it is not use the initrd, and build support
for the FS directly into the kernel.. then go modify all of the init
scripts and controls so they no longer load / unload modules to work. I
don't like doing that because I like everything to be the same.

If you mount your initrd :

mkdir /tmp/init && mount -o loop -t cramfs /boot/my-initrd.img

And edit the file "linuxrc" , you'll see where its appropriate to toss
in some more lines of code to do things.

In my case, I wanted to put all nics in an up state, initialize AoE,
aoe-ping and verify some ATA device ID's, run a few smart commands,
fetch a cluster config, then load the ocfs2 modules.

This let me pass an AoE root to the kernel so I could boot from nas
storage.

modprobe is copied to the initrd by default when you make it, however
I'm not so sure about insmod (for user modules or otherwise not included
when you run depmod). If you add any binaries just be sure you copy over
any shared objects needed, treat it as if you were populating a chroot.

It sounds like you could accomplish everything you want to do simply by
adding some code in linuxrc (its just a shell script). 

linuxrc is run just prior to the system calling pivot_root to switch to
the root file system passed to the kernel as a paramater.

I think if you just look at the file, a "light bulb" should go on for
you. My experience may not solve your problem but should help get you a
little closer to a solution.

If all you need to do is load unionfs at boot before the dom-u pivots to
the VBD you specified in its config - this should be all you need. I'm
also sure there's a much easier way of going about it, did you try just
running a depmod in the dom-u after manually installing the modules,
making a ramdisk within it and copying it over to dom-0 for use?

Sorry for the rather lengthy reply .. but as Henning also indicated ..
I'm not 100% sure what you want to accomplish.

Hope this helps.

Best,
-Tim

On Fri, 2006-11-03 at 07:58 -0600, Otter wrote:
> I am having problems with the initrd/initramfs. I am not really sure of
> what needs to be done inside the init script for a VM. Since I have
> never used a ramdisk with a VM. And I have never created an
> initrd/initramfs before ( aside from using the generic
> mkinitrd/mkinitfamfs ). Meaning I have no idea how to implement this in
> the init script.
> 
> I have placed all needed partitions in the Xen config something like:
> <lvm volume with VM image> as hda ro
> <lvm volume to contain the changes> as hdb w
> <lvm volume that contains swap> as hdc w
> 
> I am not near the machine with the exact Xen config, but I can post it
> in about 12 hours.
> 
> Inside the init script, do I need to leave all of the script that is
> generated by the mkinitrd/mkinitramfs?
> 
> I have tried just modifying the section of the script where it
> configures the root file system. I mount hda, hdb in directories in the
> initrd, and then mount the union of the two to another directory in the
> initrd. I then try and make the union directory the root filesystem.
> Then it all dies, with a kernel panic 'trying to kill init'. I can post
> the script later today as well. I just don't know enough about init
> scripts to begin tracing my error =\
> 
> Thanks for the reply!
> 
> 
> 
> Henning Sprang wrote:
> > On 11/3/06, *Otter* <OtterzStuff@xxxxxxxxxxxxx
> > <mailto:OtterzStuff@xxxxxxxxxxxxx>> wrote:
> >
> >     Greetings,
> >
> >     I would like to use unionfs for my Virtual Machines, and I would
> >     like to
> >     use initramfs instead of an initrd. But I am not sure how to
> >     accomplish
> >     this. I have read over the HOWTO section for Copy of Write, but
> >     haven't
> >     really found the solution I want. I do not know much about
> >     initramfs or
> >     initrd for that matter, but I do know initramfs is suppose to replace
> >     the initrd so I would like to use it. Ultimately what I want is to
> >     have
> >     a read only partition on LVM2 that contains the virtual machine image,
> >     and this would be readonly. Then I would have another partition that
> >     would be read write. 
> >
> >
> >
> > Just configure two disks in the VM config file. They are available as
> > partitions inside the domU then. Then, I guess the definition how they
> > should be used to achieve you goal is some config in the initrd, right?
> >
> >     I am familiar with unionfs, but not too much with
> >     Xen, so if any can provide assistance please do! 
> >
> >
> > Your question is very generic, and multiple questions at once.
> > Better describe different problems in different mail (or, forgive me
> > if I don't know enough abput initramfs and unionfs to understand they
> > belong together).
> >
> >  What did you try already, and what were your problems? What is "the
> > solution you want" you didn't find in the HOWTO's?
> >
> > Henning
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Xen-users mailing list
> > Xen-users@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-users
> 
> 
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users
> 
> 


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.