[Unionfs] UnionFS as root filesystem

Tomas M tomas at linux-live.org
Wed Mar 15 08:42:35 EST 2006


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
>



More information about the unionfs mailing list