diff options
author | Jonathan Bauer | 2019-11-18 15:08:02 +0100 |
---|---|---|
committer | Jonathan Bauer | 2019-11-18 15:08:02 +0100 |
commit | 41357d98dd7ba5a17a5bf3e3e21d4050018a4966 (patch) | |
tree | 6434528918730f3772f478301a649ad3910cadc7 | |
parent | [slx-dmsetup] fix wrong size used (diff) | |
download | systemd-init-41357d98dd7ba5a17a5bf3e3e21d4050018a4966.tar.gz systemd-init-41357d98dd7ba5a17a5bf3e3e21d4050018a4966.tar.xz systemd-init-41357d98dd7ba5a17a5bf3e3e21d4050018a4966.zip |
[slx-dmsetup] back to sparse files
since preallocating the cow file did not work well with overprovisioned
tmpfs
-rwxr-xr-x | builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device index 5d5ec267..64b12047 100755 --- a/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device +++ b/builder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device @@ -153,15 +153,8 @@ ramdisk_fallback() { fi local file="$(mktemp -u -p "$cow_tmpfs" dnbd_cow.XXX)" - local fail_count=0 - while ! fallocate -l "${cow_size}K" "$file" ; do - (( cow_size -= 4 )) - if [ "$(( fail_count ++ ))" -eq 1000 ]; then - break - fi - done - if [ "$fail_count" -eq 1000 ]; then - emergency_shell "Failed to allocate CoW file $file after 1000 tries. :(" + if ! dd of="$file" seek="$cow_size" bs=1k count=0 &> /dev/null; then + emergency_shell "Failed to allocate CoW file $file." fi writable_device="$(losetup --show --find "$file")" cow_device_candidate="root" |