From 1df5a67016d85a76ffd09e8ea234d0df23e9856b Mon Sep 17 00:00:00 2001 From: Felix Endres Date: Mon, 16 Apr 2007 16:04:01 +0000 Subject: AUFS changes. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@905 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/etc/functions | 14 ++++++++++++-- initramfs/initrd-stuff/etc/messages | 5 +++-- initramfs/initrd-stuff/etc/messages.de | 6 ++++-- initramfs/initrd-stuff/init | 19 +++++++++++++------ 4 files changed, 32 insertions(+), 12 deletions(-) (limited to 'initramfs/initrd-stuff') diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index c9f8c8be..9a049c15 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -944,7 +944,8 @@ done # It will then try to mount these uris and add them to the union at / include_in_fsroot_union () { union_id=0 # used to have guarantee differing names for the unions mount point - for ROOTFS in `echo $1 |sed 's/,/ /g'`; do + union_type=$1 + for ROOTFS in `echo $2 |sed 's/,/ /g'`; do union_id=$(( $union_id + 1 )) srvproto=$(uri_token $ROOTFS prot) case $srvproto in @@ -980,7 +981,16 @@ include_in_fsroot_union () { #iscsitarget=$(uri_token $ROOTFS path) ;; esac - unionctl /mnt/ --add --after 1 --mode ro /mnt/tmp/${root_path}_${union_id} + if [ "X$union_type" == "Xunionfs" ]; then + echo "Using unionctl to mount ${root_path}_${union_id} (type: $union_type)" + unionctl /mnt/ --add --after 1 --mode ro /mnt/tmp/${root_path}_${union_id} + elif [ "X$union_type" == "Xaufs" ]; then + #unionctl for aufs is a sh script needing tools not included in our initrd + echo "Using aufs-mount to mount ${root_path}_${union_id} (type: $union_type)" + mount -n -o remount,add:1:/mnt/tmp/${root_path}_${union_id}=ro none /mnt + else + error $init_loadunions nonfatal + fi done } diff --git a/initramfs/initrd-stuff/etc/messages b/initramfs/initrd-stuff/etc/messages index 9934bfd5..e5e34195 100644 --- a/initramfs/initrd-stuff/etc/messages +++ b/initramfs/initrd-stuff/etc/messages @@ -51,9 +51,10 @@ mean:\n * The kernel was updated but mkdxsinitrd was not run afterwards.\n\ * The mounted filesystem does not contain the modules directory at all.\n\ You might want to check the list of mounted filesystems and if /mnt is\n\ not empty run 'ls /mnt/lib/modules' to check." -init_loadufs=" Loading of UnionFS failed - Either module is not present or \ -module\n does not match the running kernel. If you do not want to see this \ +init_loadufs=" Loading of UnionFS or AUFS failed - Either modules are not present or \ +do \nnot match the running kernel. If you do not want to see this \ \n message remove the token 'unionfs' from kernel command line." +init_loadunions=" Stacking of directories failed, because UnionFS/AUFS is not loaded" init_loadcow=" Loading of Copy On Write (COW - special block device) module \ failed -\n Either module is not present or module does not match the \ running\n kernel. If you do not want to see this message remove the token \ diff --git a/initramfs/initrd-stuff/etc/messages.de b/initramfs/initrd-stuff/etc/messages.de index f57590dc..87617534 100644 --- a/initramfs/initrd-stuff/etc/messages.de +++ b/initramfs/initrd-stuff/etc/messages.de @@ -51,8 +51,10 @@ von slxmkramfs oder\n mkdxsinitrd.\n * Das eingehaengte Dateisystem \ beinhaltet das Modul-Verzeichnis ueberhaupt nicht.\n Sie sollten die Liste \ der eingehaengten Dateisysteme pruefen und wenn /mnt\n nicht leer ist, \ 'ls /mnt/lib/modules' ausfuehren." -init_loadufs=" Laden von UnionFS schlug fehl - entweder das Modul nicht \ -vorhanden oder\n es passt nicht zum laufenden Kernel. Wenn Sie diese Meldung \ +init_loadunions=" Stapeln mehrerer Verzeichnisse nicht möglich, da kein UnionFS/AUFS \ +Modul geladen ist" +init_loadufs=" Laden von UnionFS oder AUFS schlug fehl - entweder die Module sind \ +nicht vorhanden, oder\n sie passen nicht zum laufenden Kernel. Wenn Sie diese Meldung \ nicht sehen wollen,\n entfernen Sie das Token 'unionfs' von den Kernel Start \ Optionen." init_loadcow=" Laden von Copy On Write (COW - Spezielles Block Geraet) Modul \ diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 023682a5..ffcb351f 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -454,9 +454,13 @@ fi # try to use unionfs for rw access if available if [ -n "${unionfs}" -o -n "${union}" ] ; then - modprobe ${MODPRV} unionfs || { - error "$init_loadufs" nonfatal - unionfs=""; } + union_type="" + modprobe ${MODPRV} unionfs && union_type="unionfs" + modprobe ${MODPRV} aufs && union_type="aufs" + if [ -z "$union_type" ]; then + error "$init_loadufs" nonfatal + unionfs=""; + fi fi # setup of client root filesystem dependent on the availability of UnionFS @@ -466,8 +470,11 @@ if [ -n "${unionfs}" ] ; then mount -n -t tmpfs none ${rwdir}/uniontmp # hack for handling unionfs with patched run-init mount -n --move /mnt /rorootfs - mount -n -t unionfs -o dirs=${rwdir}/uniontmp:/rorootfs=${nfsro}ro \ - none /mnt + if [ "$union_type" == "unionfs" ]; then + mount -n -t unionfs -o dirs=${rwdir}/uniontmp:/rorootfs=${nfsro}ro \ + none /mnt + else mount -n -t aufs -o br:/${rwdir}/uniontmp:/rorootfs=ro none /mnt + fi mkdir -p /mnt/uniontmp mount -n --move ${rwdir}/uniontmp /mnt/uniontmp chmod 0755 /mnt/uniontmp /mnt @@ -607,7 +614,7 @@ cp /etc/machine-setup /mnt/etc # If locations are given that should be unioned with the fs root, do it if [ -n "$uniondirs" ]; then - include_in_fsroot_union $uniondirs + include_in_fsroot_union $union_type $uniondirs fi # post init for some distro specific (fixme!! more elegant solution) -- cgit v1.2.3-55-g7522