From 153d299a41b9be4e15dab1ca29bb93a74bd2445d Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 29 Apr 2016 14:36:26 -0400 Subject: fix paths (in progress) --- src/initrd/loop-layer.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/initrd/loop-layer.sh (limited to 'src/initrd/loop-layer.sh') diff --git a/src/initrd/loop-layer.sh b/src/initrd/loop-layer.sh new file mode 100644 index 0000000..7e08e12 --- /dev/null +++ b/src/initrd/loop-layer.sh @@ -0,0 +1,15 @@ +losetup_snapshot() +{ + local ro_dev rw_dev new_dev_name size persist chunksize + ro_file=$1 + rw_file=$2 + + ro_dev=$(LoSetup -r -f --show "$ro_file") || return + rw_dev=$(LoSetup -f --show "$rw_file") || return + new_dev_name=${ro_dev##*/} + size=$(blockdev --getsz "$ro_dev") || return + persist=p + chunksize=16 + dmsetup create "$new_dev_name" --table "0 $size snapshot $ro_dev $rw_dev $persist $chunksize" || return + echo /dev/mapper/"$new_dev_name" +} -- cgit v1.2.3