summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-11-18 15:08:02 +0100
committerJonathan Bauer2019-11-18 15:08:02 +0100
commit41357d98dd7ba5a17a5bf3e3e21d4050018a4966 (patch)
tree6434528918730f3772f478301a649ad3910cadc7
parent[slx-dmsetup] fix wrong size used (diff)
downloadsystemd-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-xbuilder/modules.d/slx-dmsetup/scripts/dmsetup-slx-device11
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"