diff options
Diffstat (limited to 'modules.d/slx-dmsetup/scripts/dmsetup-slx-device')
-rwxr-xr-x | modules.d/slx-dmsetup/scripts/dmsetup-slx-device | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device index 3f940821..36dfef10 100755 --- a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device +++ b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device @@ -327,21 +327,23 @@ create_pool() { # TODO handle the exotic case of a too large metadata device to fit within RAM. [ "$metadata_dev_size" -gt 33554432 ] && metadata_dev_size="33554432" # TODO handle persistent metadata device on disk + local metadata_dev= local metadata_volatile="yes" - if [ -n "$metadata_volatile" ]; then - # create RAMdisk in /run for metadata device - metadata_dev="$(mktemp -p /run/openslx .pool-metadata.XXX)" - dd of="$metadata_dev" bs=512 seek="$metadata_dev_size" &> /dev/null - metadata_dev="$(losetup --show --find $metadata_dev)" - else + if [ -z "$metadata_volatile" ]; then # create persistent slice of the writable device for the pool metadata if ! dmsetup_create_noudevsync "metadata" \ "0 $metadata_dev_size linear $writable_device 0"; then echo "$0: Failed to create linear device for pool metadata device." - # TODO fallback to RAMdisk metadata device + else + metadata_dev="/dev/mapper/metadata" + writable_device_size=$(( $writable_device_size - $metadata_dev_size )) fi - metadata_dev="/dev/mapper/metadata" - writable_device_size=$(( $writable_device_size - $metadata_dev_size )) + fi + if [ -z "$metadata_dev" ]; then + # create RAMdisk in /run for metadata device + metadata_dev="$(mktemp -p /run/openslx .pool-metadata.XXX)" + dd of="$metadata_dev" bs=512 seek="$metadata_dev_size" &> /dev/null + metadata_dev="$(losetup --show --find $metadata_dev)" fi if ! dmsetup_create_noudevsync "${pool_metadata_dev##*/}" \ "0 $metadata_dev_size linear $metadata_dev 0"; then |