summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/slx-dmsetup/hooks/dmsetup-slx-device')
-rwxr-xr-xmodules.d/slx-dmsetup/hooks/dmsetup-slx-device10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
index cf220f8d..9fde7e3e 100755
--- a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
+++ b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
@@ -247,8 +247,8 @@ ramdisk_fallback() {
# create sparse file there
local file="$cow_tmpfs/thinpool.meta"
if ! truncate -s "$(( read_only_device_sz * 512 ))" "$file" \
- && ! dd if=/dev/null of="$file" seek="$read_only_device_sz" bs=512 2> /dev/null; then
- emergency_shell "Failed to allocate CoW file $file."
+ && ! dd if=/dev/null of="$file" seek="$read_only_device_sz" bs=512; then
+ emergency_shell "Failed to allocate RAMdisk CoW file $file."
fi
declare -rg writable_device="$( losetup --show --find "$file" )"
local cow_device_candidate="root"
@@ -387,9 +387,11 @@ create_pool() {
fi
if [ -z "$metadata_dev" ]; then
# create RAMdisk in /run for metadata device
- metadata_dev="$( mktemp /run/openslx/.pool-metadata.XXXXX )"
+ mkdir -p /run/openslx
+ metadata_dev="$( mktemp /run/openslx/.pool-metadata.XXXXXX )"
# Create sparse file of required size
- dd if=/dev/null of="$metadata_dev" bs=512 seek="$metadata_dev_sz" 2> /dev/null
+ truncate -s "$(( metadata_dev_sz * 512 ))" "$metadata_dev" \
+ || dd if=/dev/null of="$metadata_dev" bs=512 seek="$metadata_dev_sz"
declare -r metadata_dev="$( losetup --show --find "$metadata_dev" )"
fi
if [ -z "$metadata_dev" ]; then