diff options
Diffstat (limited to 'modules.d/slx-dmsetup/hooks/dmsetup-slx-device')
-rwxr-xr-x | modules.d/slx-dmsetup/hooks/dmsetup-slx-device | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device index 9fde7e3e..8e3b50ca 100755 --- a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device +++ b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device @@ -191,13 +191,13 @@ encrypt_device() { fi return 0 } -# create_snapshot "<name> <persist>" +# create_snapshot "<name> <persist>" "cow_device" create_snapshot() { modprobe dm-snapshot || echo "$0: dm-snapshot loading failed, maybe builtin?" - read -r name persist ignore <<< "$1" + read -r name persist _ <<< "$1" if ! dmsetup_create_noudevsync "$name" \ - "0 $read_only_device_sz snapshot $read_only_device $writable_device ${persist:-N} 8"; then - echo "$0: Failed to create snapshot on '$writable_device' for '$read_only_device'." + "0 $read_only_device_sz snapshot $read_only_device $2 ${persist:-N} 8"; then + echo "$0: Failed to create snapshot on '$2' for '$read_only_device'." return 1 fi return 0 @@ -245,7 +245,7 @@ ramdisk_fallback() { fi # create sparse file there - local file="$cow_tmpfs/thinpool.meta" + local file="$cow_tmpfs/tmpfs-snapshot" if ! truncate -s "$(( read_only_device_sz * 512 ))" "$file" \ && ! dd if=/dev/null of="$file" seek="$read_only_device_sz" bs=512; then emergency_shell "Failed to allocate RAMdisk CoW file $file." @@ -255,7 +255,7 @@ ramdisk_fallback() { while [ -b "/dev/mapper/$cow_device_candidate" ]; do cow_device_candidate="root.$RANDOM" done - if [ -z "$writable_device" ] || ! create_snapshot "$cow_device_candidate N"; then + if [ -z "$writable_device" ] || ! create_snapshot "$cow_device_candidate N" "$writable_device"; then emergency_shell "CRITICAL: failed to setup RAMdisk fallback." exit 1 fi @@ -824,11 +824,9 @@ fi ## SNAPSHOT (OLD FUNCTIONALITY) ### if [ -n "$snapshot" ] && require_exact_scratch_size; then - read -r name crypt min max ignore <<< "$snapshot" + read -r name crypt min max _ <<< "$snapshot" [ -n "$id44_crypted" ] && crypt=0 - if ! create_snapshot "$name $persist"; then - echo "Failed to create regular snapshot for '$read_only_device' on '$scratch_device'." - else + if create_snapshot "$name N" "$scratch_device"; then finish_setup "$name" "1" "$scratch_device_sz" fi fi |