Hello

This procedure has been experimented quite a while ago it is a known issue.
In order to be able to execute the following initrd script you will need :
    - to create /mnt/gentoo /mnt/tmpfs /mnt/unionfs in the ramdisk
filesystem
    - to create the /mnt/initrd in the root filesystem

After the boot, the unionfs directories will still be available in the
/mnt/initrd/mnt directory so they can be unmounted properly by the
shutdown script.
Furthermore you can add them in the fstab file so you can remount rw
your root directory in order to modify a few files when doing
administration stuff.

Be aware that this technique do work but I am facing a bug (look in the
mailing list archive) that has not been corrected yet.
When putting your root file system read-only and having all the modified
files written in the tmpfs, unionfs sometimes hangs and the whole system
crashes.
Don't use it on production systems.

Regards

S. Thabuteau

initrd.sh follow

#!/bin/sh
mount -n -o remount,rw /
mount -n -t proc none /proc
cp /proc/mounts /etc/mtab
mount -t sysfs none /sys
mdev -s

CMDLINE="`cat
/proc/cmdline`"                                                                 
                                                                                
                    

for x in ${CMDLINE}
do
    case "${x}" in
        debug)
            DEBUG='yes'
            ;;
    esac
done

if [ -n "$DEBUG" ]
then
    [ -x /bin/sh ] && /bin/sh || /bin/ash
fi

echo "initrd: mount procedure starting."
mount -t ext4 -o ro /dev/sda2 /mnt/gentoo
mount -t tmpfs none /mnt/tmpfs
mount -t unionfs -o ro,dirs=/mnt/tmpfs=rw:/mnt/gentoo=ro none /mnt/unionfs
echo "initrd: mount procedure result."
mount
echo "initrd: mount procedure ending."

umount /sys
umount /proc

cd /mnt/unionfs
pivot_root . /mnt/unionfs/mnt/initrd
exec chroot . /bin/sh <<- EOF
    echo "initrd: now executing init."
    exec /sbin/init
EOF

echo "initrd: mount procedure failure. fallback to shell..."
sh
/bin/sh
exec sh
exec sh
_______________________________________________
unionfs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to