diff options
-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" |