WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] UnionFS and initramfs

Thanks for the reply Tim,

I expanded the initrd, but I do not see a linuxrc.

Here is my Xen config, and init script from the initrd

Xen Config:

    # Kernel image file.
    kernel = "/boot/vmlinuz-2.6.16-xen"

    # Optional ramdisk.
    ramdisk = "/root/Desktop/initrd_t1.img"

    #vif = [ 'mac=00:00:00:00:00:01, bridge=xenbr0' ]

    disk = [ 
'phy:/dev/VolGroup00/VM_IMAGE,hda,r','phy:/dev/VolGroup00/VM_DELTA,hdb,w','phy:/dev/VolGroup00/VM_SWAP,hdc,w'
 ]

    # Set root device.
    root = "/VM_UNION"
      

for the root portion of the config I had originally used /dev/hda ro.

Init:

    #!/bin/nash

    mount -t proc /proc /proc
    setquiet
    echo Mounting proc filesystem
    echo Mounting sysfs filesystem
    mount -t sysfs /sys /sys
    echo Creating /dev
    mount -o mode=0755 -t tmpfs /dev /dev
    mkdir /dev/pts
    mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
    mkdir /dev/shm
    mkdir /dev/mapper
    echo Creating initial device nodes
    mknod /dev/null c 1 3
    mknod /dev/zero c 1 5
    mknod /dev/systty c 4 0
    mknod /dev/tty c 5 0
    mknod /dev/console c 5 1
    mknod /dev/ptmx c 5 2
    mknod /dev/rtc c 10 135
    mknod /dev/tty0 c 4 0
    mknod /dev/tty1 c 4 1
    mknod /dev/tty2 c 4 2
    mknod /dev/tty3 c 4 3
    mknod /dev/tty4 c 4 4
    mknod /dev/tty5 c 4 5
    mknod /dev/tty6 c 4 6
    mknod /dev/tty7 c 4 7
    mknod /dev/tty8 c 4 8
    mknod /dev/tty9 c 4 9
    mknod /dev/tty10 c 4 10
    mknod /dev/tty11 c 4 11
    mknod /dev/tty12 c 4 12
    mknod /dev/ttyS0 c 4 64
    mknod /dev/ttyS1 c 4 65
    mknod /dev/ttyS2 c 4 66
    mknod /dev/ttyS3 c 4 67
    echo Setting up hotplug.
    hotplug
    echo Creating block device nodes.
    mkblkdevs
    echo "Loading jbd.ko module"
    insmod /lib/jbd.ko 
    echo "Loading ext3.ko module"
    insmod /lib/ext3.ko 
    echo "Loading dm-mod.ko module"
    insmod /lib/dm-mod.ko 
    echo "Loading dm-mirror.ko module"
    insmod /lib/dm-mirror.ko 
    echo "Loading dm-zero.ko module"
    insmod /lib/dm-zero.ko 
    echo "Loading dm-snapshot.ko module"
    insmod /lib/dm-snapshot.ko 
    echo "Loading unionfs.ko module"
    insmod /lib/unionfs.ko
    echo Making device-mapper control node
    mkdmnod
    mkblkdevs
    #echo Scanning logical volumes
    #lvm vgscan --ignorelockingfailure
    #echo Activating logical volumes
    #lvm vgchange -ay --ignorelockingfailure  VolGroup00
    echo "Resuming VM swap hdc"
    resume /dev/hdc
    echo "Mounting Read Only device"
    mount -t ext3 /dev/hda /VM_RO
    echo "Mounting Read Write device"
    mount -t ext3 /dev/hdb /VM_RW
    echo Creating root device.
    mkrootdev -t unionfs -o dirs=/VM_RW:/VM_RO=ro /UNION
    echo Mounting root filesystem.
    mount /sysroot
    echo Setting up other filesystems.
    setuproot
    echo Switching to new root and running init.
    switchroot

Sorry for the delay in getting this info posted,

And thanks for all pointers so far!

James

Tim Post wrote:
> 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

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