diff --git a/entry.sh b/entry.sh index 5bd06b1..7faf23e 100755 --- a/entry.sh +++ b/entry.sh @@ -17,6 +17,9 @@ function first_stage(){ apt install -y debootstrap cryptsetup btrfs-progs lvm2 if [ -d /dev/vg0 ]; then + mount | grep target | awk '{print $3}'| sort -r | while read LINE; do + umount -l $LINE; + done swapoff /dev/vg0/swap || true vgchange -an /dev/vg0 fi @@ -55,7 +58,7 @@ function first_stage(){ LVM_SIZE=$(dev_size /dev/mapper/cryptlvm) - SWAP_SIZE=$(($(mem_size)/1000/1000)) + SWAP_SIZE=$(($(mem_size)/1024/1024)) ROOT_SIZE=$(($LVM_SIZE/1024/1024-SWAP_SIZE)) echo lvcreate /dev/vg0 --name=root --size=${ROOT_SIZE}M