[Unionfs] UnionFS as root filesystem

Francesco Carsana francescocarsana at ds4.it
Fri Mar 10 11:38:02 EST 2006


I have configured a system like this:

- 3 partitions: hda1, hda2, hda3.
- In hda1 I've installed Knoppix 3.7 (kernel 2.4.27) on an ext3
filesystem
- hda2 is a clean ext3 partition
- hda3 is a swap partition

I'd like to use UnionFS as root filesystem in order to merge hda1 (read
only) and hda2 (read write).
In this way all the system chages will be saved in hda2, leaving hda1
unchanged.
I use an initrd tha contains the following linuxrc:

  #!/bin/sh
  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
  modprobe unionfs
  mount -t unionfs -o dirs="/mnt/hda2=rw:/mnt/hda1=ro" unionfs /mnt/hda2
  umount /proc
  cd /mnt/hda2
  mkdir -p initrd
  pivot_root . initrd
 
At boot I obtain a kernel panic:

  Kernel panic: VFS: Unable to mount root fs on 03:02

I use grub as boot manager, with this configuration:

  title       Debian GNU/Linux, kernel 2.4.27 (Safe Mode)
  root      (hd0,0)
  kernel    /boot/vmlinuz-2.4.27 root=/dev/hda2 ro ramdisk_size=100000 \
              init=/etc/init lang=us apm=power-off nomce
  initrd     /boot/roinitrd.img.gz
  savedefault
  boot

If I add this line at linuxrc, after pivot root:

  exec chroot . bin/bash <dev/console >dev/console 2>&1

I obtain that:

- The system doesn't crash and UnionFS is correctly mounted as root
filesystem
- The init process doesn't start: in this way I can't use the graphical
environment (KDE)!

My goal is to obtain a system that works in the same way as if I boot
from
hda1 only, but that doesn't modify hda1 (the changes are written only on
hda2).
Is it possible?
Can anyone help me to resolve the problem?
Are there any alternative methods to obtain what I want?

Thanks.
Francesco





More information about the unionfs mailing list