Hello,

I've added yet another persistence mechanism for casper, that utilize loop
mounts.
With this patch, casper probes and mounts EXT3 image files under /home and
/root.
This patch is useful for keeping changes on R/W media such as USB stick or
hard disks.
When the media is read only such as CD, there is no point of using this...
Unless someone will add an option to mount another device which *is*
persistence.

To use this patch, create an EXT3 image in the root of the media - example:

dd if=/dev/zero of=binary/home count=100000
mkfs.ext3 -jF binary/home
tune2fs -i 0 -c -1 binary/home

The default location of the files are /live_media/home and /live_media/root
Any writes to /home or /root will be written to the corresponding image
files.

To specify another location, simply specify home_loop=/path/to/home-image
and/or root_loop=/path/to/root-image

Regards,
Hadar
--- /home/hadar/dev/casper/casper-1.81+debian/scripts/casper 
+++ /home/hadar/dev/neolive/casper/patches/loop_persistence.patch 
@@ -11,6 +11,8 @@
 root_snapshot_label="casper-sn"
 home_snapshot_label="home-sn"
 
+ROOT_LOOP="/root"
+HOME_LOOP="/home"
 USERNAME="casper"
 USERFULLNAME="Live session user"
 HOSTNAME="live"
@@ -100,6 +102,10 @@
                 ;;
             console=*)
                 export DEFCONSOLE="${x#*=}" ;;
+            root_loop=*)
+                export ROOT_LOOP=${x#root_loop=} ;;
+            home_loop=*)
+                export HOME_LOOP=${x#home_loop=} ;;
         esac
     done
 
@@ -468,6 +474,18 @@
     mount ${cowdevice} -t ${cow_fstype} -o rw /cow || panic "Can not mount $cowdevice on /cow"
 
     mount -t unionfs -o dirs=/cow=rw:$rofsstring unionfs "$rootmnt" || panic "Unionfs mount failed"
+	# loop mount EXT3 files
+	homeimagepath="${mountpoint}""${HOME_LOOP}"
+	if [ -f "${homeimagepath}" ]; then
+		#ext3 is hardcoded here because it is not recognized automatically
+		mount -t ext3 -o loop "${homeimagepath}" "${rootmnt}"/home
+	fi
+
+	rootimagepath="${mountpoint}""${ROOT_LOOP}"
+	if [ -f "{$rootimagepath}" ]; then
+		#ext3 is hardcoded here because it is not recognized automatically
+		mount -t ext3 -o loop "${rootimagepath}" "${rootmnt}"/root
+	fi
 
     # Adding other custom mounts
     if [ -n "${PERSISTENT}" ]; then
_______________________________________________
Debian-live-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

Reply via email to