summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh15
-rw-r--r--dev-tools/example-openslx.config8
2 files changed, 16 insertions, 7 deletions
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
index 7e858b25..2492e493 100755
--- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
+++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
@@ -41,10 +41,10 @@ fi
# Make read-only partition writable.
## detect partition for persistent storage
local persistent_device=$(utils.find_block_device \
- "$SLX_PERSISTENT_PARTITION_PATTERN_LABEL_UUID_TYPE")
+ "$SLX_WRITABLE_DEVICE_IDENTIFIER")
# TODO move somewhere else
#local tmp_device=$(utils.find_block_device \
- #'$SLX_TMP_PARTITION_PATTERN_LABEL_UUID_TYPE')
+ #'$SLX_TMP_PARTITION_IDENTIFIER')
#if [ -n $tmp_device ]; then
#mount -t auto "$tmp_device" $NEWROOT/tmp
@@ -54,9 +54,15 @@ local persistent="N" # 'P' for persistent storage, 'N' for not persistent
local writable_device
if [ -n "$persistent_device" ]; then
writable_device=$persistent_device
- persistent="P"
+ if [ "$SLX_WRITABLE_DEVICE_PERSISTENT" = "yes" ]; then
+ persistent="P"
+ fi
else
- modprobe brd max_part=1 rd_size=$SLX_RAMDISK_SIZE
+ local ramdisk_size="$SLX_RAMDISK_SIZE"
+ if [ "ramdisk_size" = "" ]; then
+ ramdisk_size=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}')
+ fi
+ modprobe brd max_part=1 rd_size=$ramdisk_size
writable_device="/dev/ram0"
persistent="N"
fi
@@ -69,6 +75,7 @@ fi
local partition_size="$(blockdev --getsz "$read_only_partition")"
local writable_partition_name="root"
+logging.info "Using writable device $writable_device, persistency: $persistent"
local chunksize="1"
modprobe dm_snapshot
dmsetup create "$writable_partition_name" --noudevsync --table \
diff --git a/dev-tools/example-openslx.config b/dev-tools/example-openslx.config
index 4db11c6b..1d765115 100644
--- a/dev-tools/example-openslx.config
+++ b/dev-tools/example-openslx.config
@@ -4,9 +4,11 @@ SLX_DNBD3_RID='0'
SLX_DNBD3_DEVICE='/dev/dnbd0'
SLX_DNBD3_IMAGE='archLinux.vmdk'
SLX_SYSTEM_PARTITION_IDENTIFIER='system'
-SLX_PERSISTENT_PARTITION_PATTERN_LABEL_UUID_TYPE=''
-SLX_TMP_PARTITION_PATTERN_LABEL_UUID_TYPE=''
-SLX_RAMDISK_SIZE=524288
+SLX_TMP_PARTITION_IDENTIFIER=''
+SLX_WRITABLE_DEVICE_IDENTIFIER=''
+SLX_WRITABLE_DEVICE_PERSISTENT='yes'
+# if empty will use all available ram
+SLX_RAMDISK_SIZE=''
SLX_MOUNT_ROOT_OPTIONS='-o subvol=root'
# TODO: Following parameter aren't supported yet.