@@ -53,29 +53,19 @@ lvs /dev/store/shared-data >/dev/null 2>&1 || (
5353 retry lvcreate --yes -L " $LV_SIZE_MB " M -n shared-data store
5454)
5555
56- TOTAL_SIZE_MB=$(( $(blockdev -- getsz / dev/ mapper/ store- crypt) * 512 / 1024 / 1024 ))
57- # Limit to 500G or 25% of capacity, whichever is lower.
58- LV_SIZE_MB=$(( "$TOTAL_SIZE_MB " / 4 ))
59- LV_SIZE_LIMIT_MB=500000
60- if [ " ${LV_SIZE_MB} " -gt " ${LV_SIZE_LIMIT_MB} " ]; then
61- LV_SIZE_MB=" ${LV_SIZE_LIMIT_MB} "
62- fi
63-
6456# Set up backup data store if it does not exist yet.
6557lvs /dev/store/shared-backup > /dev/null 2>&1 || (
6658 echo " Logical volume 'shared-backup' does not exist yet (first boot?), creating it."
59+ TOTAL_SIZE_MB=$(( $(blockdev -- getsz / dev/ mapper/ store- crypt) * 512 / 1024 / 1024 ))
60+ # Limit to 500G or 25% of capacity, whichever is lower.
61+ LV_SIZE_MB=$(( "$TOTAL_SIZE_MB " / 4 ))
62+ LV_SIZE_LIMIT_MB=500000
63+ if [ " ${LV_SIZE_MB} " -gt " ${LV_SIZE_LIMIT_MB} " ]; then
64+ LV_SIZE_MB=" ${LV_SIZE_LIMIT_MB} "
65+ fi
6766 retry lvcreate --yes -L " $LV_SIZE_MB " M -n shared-backup store
6867)
6968
70- # TODO(NODE-1722): remove once every GuestOS has been upgraded after the LV resize
71- # We use sectors because lvs outputs MB in ##.00 format which is annoying to compare since we don't
72- # have bc in GuestOS.
73- SECTORS_PER_MB=2048
74- if (( $(lvs -- noheadings -- nosuffix -- units 's' - o lv_size / dev/ mapper/ store- shared-- backup) < (LV_SIZE_MB * SECTORS_PER_MB)) ); then
75- echo " Resizing logical volume 'shared-backup' to ${LV_SIZE_MB} MB."
76- retry lvresize --yes -L " $LV_SIZE_MB " M -n /dev/mapper/store-shared--backup
77- fi
78-
7969# Set up swap space if it does not exist yet.
8070lvs /dev/store/shared-swap > /dev/null 2>&1 || (
8171 echo " Logical volume 'shared-swap' does not exist yet (first boot?), creating it."
0 commit comments