[Unionfs] UnionFS as root filesystem

Olivier Evalet evaleto at programmers.ch
Wed Mar 15 09:13:00 EST 2006


It could help you,

linuxrc must have PID==1 to start correctly sbin/init ! Have a look on
your boot params. Below my config for a 2.6 kernel:
root=/dev/ram0 init=/linuxrc rw

I did a complet and small initrd with gentoo-uclibc that mount a unionfs
backend (debian/ubuntu/gentoo) as rootfs, configure the backend and
start /sbin/init. 


Olivier


Le mercredi 15 mars 2006 à 14:42 +0100, Tomas M a écrit :
> I am not using /sbin/init, but sbin/init (note that the leading slash is 
> not there):
> 
> #  exec chroot . sbin/init  <dev/console >dev/console 2>&1
> 
> This works for me.
> 
> Tomas M
> 
> 
> Francesco Carsana wrote:
> > Tomas M wrote:
> >> > mount -o dirs=/mnt/hda1=ro:/mnt/hda2=rw unionfs /mnt/hda2
> >>
> >> That mount command is wrong, at first, leftmost branch must be 
> >> writable, not ro.
> >> I don't know if you can overmount the directory used in unionfs as a 
> >> branch,
> >> I believe that the result is undefined and you should not do that.
> >>
> >> Tomas
> >
> >
> > I'm working with Knoppix 3.7 (Kernel 2.4.27) and UnionFS 1.0.14.
> > I must use kernel 2.4.27 because it's necessary for other purposes 
> > (RTLinux...)
> > My linuxrc is like this:
> >
> >   #!/bin/sh
> >   set -x
> >   export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
> >   mount -t proc /proc /proc
> >   mkdir -p /mnt
> >   mkdir -p /mnt/hda2
> >   mount -nt ext3 -o rw /dev/hda2 /mnt/hda2
> >   mkdir -p /mnt/hda1
> >   mount -nt ext3 -o ro /dev/hda1 /mnt/hda1
> >   mkdir -p /mnt/union
> >   modprobe unionfs
> >   mount -t unionfs -o dirs="/mnt/hda2=rw:/mnt/hda1=ro" unionfs /mnt/union
> >   cd /mnt/union
> >   mkdir -p initrd
> >   pivot_root . initrd
> >   exec chroot . /sbin/init  <dev/console >dev/console 2>&1
> >
> > And grub's menu.lst is:
> >
> >   title        Debian GNU/Linux, kernel 2.4.27 (Safe Mode)
> >   kernel       (hd0,0)/boot/vmlinuz-2.4.27 rw root=/dev/hda2
> >                  init=/etc/init ramdisk_size=100000 lang=us
> >                  screen=1280x1024 vga=0x31B nomce apm=power-off
> >   initrd       (hd0,0)/boot/roinitrd.img.gz
> >   savedefault
> >   boot
> >
> > If I write "/bin/bash" insted of "/sbin/init" in the last life of 
> > linuxrc,
> > I obtain the root filesystem that I want (union between hda1 and hda2) 
> > but
> > the init process doesn't start, so I think that pivot root works well...
> > If I leave "/sbin/init" the init process remount /dev/hda2 as root 
> > filesystem
> > (hda2 is a clean ext3 partition) and obviously can't find /sbin/init.
> > Infact the kernel prints these messages:
> >
> >   Usage: init 0123456SsQqAaBbCcUu
> >   VFS: Mounted root (ext3 filesystem).
> >   Trying to move old root to /initrd ... okay
> >   Freeing unused kernel memory: 144k freed
> >   Warning: unable to open an initial console.
> >   Kernel panic: No init found. Try passing init= option to kernel
> >
> >
> >
> >
> > _______________________________________________
> > unionfs mailing list
> > unionfs at mail.fsl.cs.sunysb.edu
> > http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs
> >
> _______________________________________________
> unionfs mailing list
> unionfs at mail.fsl.cs.sunysb.edu
> http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs
-- 
------------------
 Linux for Geneva
   www.gelux.ch




More information about the unionfs mailing list