@babam
Regarding the overlapping of the same file name, this implementation is
simplified and deficient compared to AUFS.
Your pointing is exactly pointing out this deficiency.
Thanks.
-----------------
My test2 result:
Boot original Porteus-XFCE-v5.0rc2-k5.9rc5-x86_64.iso with the grub2 entry following.
menuentry "5.0rc2=====>Porteus-XFCE-v5.0rc2-k5.9rc5-x86_64.iso<======" {
search --no-floppy --fs-uuid --set=root $BIGuuid
set ISO="/porteus/5.0/rc2/Porteus-XFCE-v5.0rc2-k5.9rc5-x86_64.iso"
loopback loop $ISO
linux (loop)/boot/syslinux/vmlinuz from=UUID:${BIGuuid}$ISO copy2ram kmap=jp \
changes=UUID:${uuid}/porteus/5.0/rc2/persist
initrd (loop)/boot/syslinux/initrd.zstd
}
Code: Select all
% su
# ls /bin/foo
/bin/ls: cannot access '/bin/foo': No such file or directory
# echo "This file is in CHANGES file." > /bin/foo
# cat /bin/foo
This file is in CHANGES file.
# reboot
Reboot by the same grub2 entry.
Code: Select all
% su
# cat /bin/foo
This file is in CHANGES file.
# ls *.xzm
activateModule.xzm baseModule.xzm
# activate baseModule.xzm
# cat /bin/foo
This is the file in baseModule/bin/foo.
# activate activateModule.xzm
# cat /bin/foo
This is the file in activateModule/bin/foo.
# deactivate baseModule.xzm
# cat /bin/foo
This file is in CHANGES file.
# reboot
Reboot by the same grub2 entry.
Code: Select all
% su
# cat /bin/foo
This file is in CHANGES file.
# activate activateModule.xzm
# cat /bin/foo
This is the file in activateModule/bin/foo.
# reboot
Reboot by the same grub2 entry.
Code: Select all
% su
# cat /bin/foo
cat: /bin/foo: No such file or directory
#
----------------------------------
Why are the results different with you?
---->
Since the original is not restored, it will be deleted if the original is on the persistence (variation inheritance) file.
AT "setClean" function in "finit" file of initrd for OVFS,
"# mv $x $DIR/$PKG" is commented out.
Code: Select all
% diff -r AUFS-initrd/ OV.initrd/
diff -r AUFS-initrd/cleanup OV.initrd/cleanup
12a13,15
>
> mkdir -p union
>
34,45c37,50
< if [ -e /tmp/changes-exit ]; then
< echo -e "Your session will be saved in 3 seconds.\nPress space/enter to start doing it now or any other key to skip."; x=3
< while [ $x -gt 0 ]; do read -s -t1 -n1 ans && break || sleep 1; let x=x-1; done
< if [ "$ans" = "" ]; then
< DEST=`cat /tmp/changes-exit`; NAME=`basename $DEST`; MNAME=/memory/images/changes; FOLDERS=`grep '^/' /union/etc/changes-exit.conf | sed s/^.//g`
< echo "saving changes to $NAME - do not power off the PC"
< cd /memory/changes; rm -rf var/lock/subsys/* var/run/laptop-mode-tools/* `grep '^!' /union/etc/changes-exit.conf | sed s/^..//g | tr "\n" " "`
< for x in `find $FOLDERS -name ".wh.*" 2>/dev/null | sed s/.wh.//g | tr ' ' '@'`; do x=`echo $x | tr '@' ' ' `; test -e $MNAME/"$x" && rm -rf $MNAME/"$x"; done
< for x in `find $MNAME -name ".wh.*" 2>/dev/null | tr ' ' '@'`; do x=`echo $x | tr '@' ' ' `; wh=`echo $x | sed -e s^$MNAME^^g -e s/.wh.//g`; test -e "$wh" && rm "$x"; done
< cp -afu --parents $FOLDERS $MNAME 2>/dev/null
< fi
< elif grep -q ^memory /var/log/livedbg; then
---
> #if [ -e /tmp/changes-exit ]; then
> # echo -e "Your session will be saved in 3 seconds.\nPress space/enter to start doing it now or any other key to skip."; x=3
> # while [ $x -gt 0 ]; do read -s -t1 -n1 ans && break || sleep 1; let x=x-1; done
> # if [ "$ans" = "" ]; then
> # DEST=`cat /tmp/changes-exit`; NAME=`basename $DEST`; MNAME=/memory/images/changes; FOLDERS=`grep '^/' /union/etc/changes-exit.conf | sed s/^.//g`
> # echo "saving changes to $NAME - do not power off the PC"
> # cd /memory/changes; rm -rf var/lock/subsys/* var/run/laptop-mode-tools/* `grep '^!' /union/etc/changes-exit.conf | sed s/^..//g | tr "\n" " "`
> # for x in `find $FOLDERS -name ".wh.*" 2>/dev/null | sed s/.wh.//g | tr ' ' '@'`; do x=`echo $x | tr '@' ' ' `; test -e $MNAME/"$x" && rm -rf $MNAME/"$x"; done
> # for x in `find $MNAME -name ".wh.*" 2>/dev/null | tr ' ' '@'`; do x=`echo $x | tr '@' ' ' `; wh=`echo $x | sed -e s^$MNAME^^g -e s/.wh.//g`; test -e "$wh" && rm "$x"; done
> # cp -afu --parents $FOLDERS $MNAME 2>/dev/null
> # fi
> #elif grep -q ^memory /var/log/livedbg; then
>
> if grep -q ^memory /var/log/livedbg; then
diff -r AUFS-initrd/finit OV.initrd/finit
44c44,46
< aufs / aufs defaults 0 0
---
> #aufs / aufs defaults 0 0
> rootOV / overlay 0 0
>
157a160,260
>
> #======================================
> # setClean
> #--------------------------------------
> setClean()
> {
> #=== 変分反映層
> mkdir -p /memory/changes/upperdir
> #=== 変分管理データ層
> mkdir -p /memory/changes/workdir
>
> #--<継承エリア初期化>--#
> local PLACE=/memory/changes/upperdir
> rm -rf $PLACE/boot 2>/dev/null
> rm -rf $PLACE/dev 2>/dev/null
> rm -rf $PLACE/mnt 2>/dev/null
> rm -rf $PLACE/proc 2>/dev/null
> rm -rf $PLACE/run 2>/dev/null
> rm -rf $PLACE/sys 2>/dev/null
> rm -rf $PLACE/tmp 2>/dev/null
> rm -rf $PLACE/var/lock/* 2>/dev/null
> rm -rf $PLACE/var/run 2>/dev/null
> rm -rf $PLACE/var/tmp 2>/dev/null
> rm -rf $PLACE/var/spool/cron/cron.?????? 2>/dev/null
>
> # chown -R guest:users $PLACE/home/guest 2>/dev/null
>
> #--< activate 後 deactivate 無しで終了した残骸を削除する >--#
> #--- delete symbolic link setting "entity & tag" ---#
> local x
> local DIR
> local PKG
> for x in `find $PLACE -name '.act.new.*' `
> do
> DIR=${x%/*}
> PKG=${x##*/}
> PKG=${PKG#.act.new.}
> #echo "x=$x DIR=$DIR PKG=$PKG"
> if [ -h $DIR/$PKG ]
> then
> rm $DIR/$PKG
> fi
> rm $x
> done
>
> #--- recover original entity ---#
> for x in `find $PLACE -name '.act.org.*' `
> do
> # DIR=${x%/*}
> # PKG=${x##*/}
> # PKG=${PKG#.act.org.}
> # mv $x $DIR/$PKG
> rm $x
> done
> }
> #======================================
> # IncludeModules
> #--------------------------------------
> IncludeModules()
> {
> #=== 変分反映層
> mkdir -p /memory/changes/upperdir
> UPPERDIR=/memory/changes/upperdir
> #=== 変分管理データ層
> mkdir -p /memory/changes/workdir
> WORKDIR=/memory/changes/workdir
>
> #--<継承エリア初期化>--#
> setClean
>
> #=== 固定不変層
> LOWLIST=""
> for x in `cat /tmp/modules`;
> do
> NAME=`basename $x`;
> mkdir /memory/images/$NAME;
> mount -o loop $x /memory/images/$NAME 2>/dev/null
> if [ $? -eq 0 ];
> then
> echo " $m $NAME";
> LOWLIST=/memory/images/${NAME}:${LOWLIST}
> else
> echo $i"""Cannot read $NAME - corrupted module?""";
> rmdir /memory/images/$NAME
> fi
> done
> if [ -d /memory/images/CHANGES ]
> then
> LOWLIST=/memory/images/CHANGES/upperdir:${LOWLIST}
> cp -a /memory/images/CHANGES/workdir/* $WORKDIR/.
> fi
> LOWLIST=`echo $LOWLIST | sed 's/:$//'`
>
> #echo "mount -t overlay -o upperdir=$UPPERDIR,lowerdir=$LOWLIST,workdir=$WORKDIR overlay /union"
> mount -t overlay -o upperdir=$UPPERDIR,lowerdir=$LOWLIST,workdir=$WORKDIR rootOV /union
> if [ $? -ne 0 ]
> then
> sh
> fi
> }
>
diff -r AUFS-initrd/linuxrc OV.initrd/linuxrc
121a122,124
>
> CHNEXIT=""
>
150,153c153,158
< rmdir /memory/changes/mnt/* 2>/dev/null
< rm -rf /memory/changes/var/lock/* /var/run/laptop-mode-tools/* /var/spool/cron/cron.??????
< for x in `find /memory/changes/var/run -name "*pid" 2>/dev/null`; do rm $x; done
< if [ $CHNEXIT = EXIT -o "`egrep -o " changes-ro( |\$)" /proc/cmdline`" ]; then
---
>
> # rmdir /memory/changes/mnt/* 2>/dev/null
> # rm -rf /memory/changes/var/lock/* /var/run/laptop-mode-tools/* /var/spool/cron/cron.??????
> # for x in `find /memory/changes/var/run -name "*pid" 2>/dev/null`; do rm $x; done
>
> if [ "$CHNEXIT" = EXIT -o "`egrep -o " changes-ro( |\$)" /proc/cmdline`" ]; then
156,160c161,174
< for x in `find /memory/changes -name ".wh.*" | grep -v '.wh..wh..opq' | tr ' ' '@' `; do x=`echo $x | tr '@' ' ' `; cp -a --parents "$x" /var; done
< umount /memory/changes; mount -nt tmpfs -o size=$RAMSIZE tmpfs /memory/changes
< # need to fix busybox bug on 'cp -a' as it does not preserve perms on dirs:
< mv /var/memory/changes/* /memory/changes 2>/dev/null; CHANGES=memory
< chown -R guest /memory/changes/home/guest 2>/dev/null
---
>
> # for x in `find /memory/changes -name ".wh.*" | grep -v '.wh..wh..opq' | tr ' ' '@' `; do x=`echo $x | tr '@' ' ' `; cp -a --parents "$x" /var; done
> # umount /memory/changes; mount -nt tmpfs -o size=$RAMSIZE tmpfs /memory/changes
> # # need to fix busybox bug on 'cp -a' as it does not preserve perms on dirs:
> # mv /var/memory/changes/* /memory/changes 2>/dev/null; CHANGES=memory
> # chown -R guest /memory/changes/home/guest 2>/dev/null
>
> setClean
> mkdir -p /memory/images/CHANGES
> mount -n --move /memory/changes /memory/images/CHANGES
> umount /memory/changes;
> mount -nt tmpfs -o size=$RAMSIZE tmpfs /memory/changes;
> CHANGES=memory
>
161a176,177
>
>
177,179c193,195
< echo $i"creating live filesystem and inserting modules"
< mount -t aufs -o nowarn_perm,xino=/memory/xino/.aufs.xino,br:/memory/changes=rw aufs /union
< if [ $? -ne 0 ]; then echo -e """cant setup union (aufs) - read only filesystem?\nWhen you finish debugging press Ctrl+Alt+Del to reboot."""; sh; fi
---
> #echo $i"creating live filesystem and inserting modules"
> #mount -t aufs -o nowarn_perm,xino=/memory/xino/.aufs.xino,br:/memory/changes=rw aufs /union
> #if [ $? -ne 0 ]; then echo -e """cant setup union (aufs) - read only filesystem?\nWhen you finish debugging press Ctrl+Alt+Del to reboot."""; sh; fi
257,266c273,287
< while read line; do
< NAME=`basename "$line"`
< mkdir /memory/images/"$NAME"
< mount -o loop "$line" /memory/images/"$NAME" 2>/dev/null
< if [ $? -eq 0 ]; then
< echo " $m $NAME"; mount -no remount,add:1:/memory/images/"$NAME"=rr aufs /union
< else
< echo $i"""Cannot read $NAME - corrupted module?"""; rmdir /memory/images/"$NAME"
< fi
< done < /tmp/modules
---
>
> #while read line; do
> # NAME=`basename "$line"`
> # mkdir /memory/images/"$NAME"
> # mount -o loop "$line" /memory/images/"$NAME" 2>/dev/null
> # if [ $? -eq 0 ]; then
> # echo " $m $NAME"; mount -no remount,add:1:/memory/images/"$NAME"=rr aufs /union
> # else
> # echo $i"""Cannot read $NAME - corrupted module?"""; rmdir /memory/images/"$NAME"
> # fi
> #done < /tmp/modules
>
> IncludeModules
>
>
270,282c291,303
< if [ -e /tmp/changes-exit ]; then
< mkdir /memory/images/changes
< if [ -d $CHNEXIT ]; then
< mount -o bind $CHNEXIT/changes /memory/images/changes
< elif [ -b /dev/mapper/crypt ]; then
< mount /dev/mapper/crypt /memory/images/changes
< else
< mount -o loop $CHNEXIT /memory/images/changes
< fi
< echo " $m changes"; mount -no remount,add:1:/memory/images/changes=ro aufs /union
< echo $CHNEXIT/changes >>/tmp/modules
< param changes-ro && rm /tmp/changes-exit
< fi
---
> #if [ -e /tmp/changes-exit ]; then
> # mkdir /memory/images/changes
> # if [ -d $CHNEXIT ]; then
> # mount -o bind $CHNEXIT/changes /memory/images/changes
> # elif [ -b /dev/mapper/crypt ]; then
> # mount /dev/mapper/crypt /memory/images/changes
> # else
> # mount -o loop $CHNEXIT /memory/images/changes
> # fi
> # echo " $m changes"; mount -no remount,add:1:/memory/images/changes=ro aufs /union
> # echo $CHNEXIT/changes >>/tmp/modules
> # param changes-ro && rm /tmp/changes-exit
> #fi
431a453,455
>
> mkdir -p /union/mnt/live
>
$