diff options
author | Jonathan Bauer | 2019-08-27 13:10:00 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-08-27 13:10:00 +0200 |
commit | 18ea96f370dc2e12c379c3b4f7d88e804ef4e6d6 (patch) | |
tree | 6234717c9b2b99ebc1926c422b00d4eac8383521 /builder/modules.d/slx-dmsetup | |
parent | [slx-network] remove unneeded sourcing (diff) | |
download | systemd-init-18ea96f370dc2e12c379c3b4f7d88e804ef4e6d6.tar.gz systemd-init-18ea96f370dc2e12c379c3b4f7d88e804ef4e6d6.tar.xz systemd-init-18ea96f370dc2e12c379c3b4f7d88e804ef4e6d6.zip |
[slx-dmsetup] fix small ID44 / large filesystem
read the comments for the why :)
Diffstat (limited to 'builder/modules.d/slx-dmsetup')
-rwxr-xr-x | builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device index 29796d84..c0f6a274 100755 --- a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device +++ b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device @@ -410,11 +410,22 @@ if [ -n "$thin_snapshot" ] || [ -n "$thin_volume" ]; then # create thin-snapshot, use first one read -r name crypt min max ignore <<< "$thin_snapshot" # min/max was used for the pool data device, ignore it here! - if ! create_volume "$name 1 $writable_device_size $read_only_device"; then + # NOTE: the filesystem will most likely malfunction if the size of the + # thin-snapshot is smaller than what it was upon creation. + # As such, the size of the thin-snapshot can only be $writable_device_size + # if it is larger than $read_only_device_size, otherwise we should only + # use $read_only_device_size. While live-shrinking the filesystem might be + # an option, it is not supported throughout all fileystems (xfs can't). + if (( writable_device_size >= read_only_device_size )); then + thin_snapshot_size="$writable_device_size" + else + thin_snapshot_size="$read_only_device_size" + fi + if ! create_volume "$name 1 $thin_snapshot_size $read_only_device"; then echo "Failed to create external snapshot for '$read_only_device'." ramdisk_fallback fi - finish_setup "$name" "1" "$writable_device_size" + finish_setup "$name" "1" "$thin_snapshot_size" fi fi |