Skip to content

Commit 51ddfcf

Browse files
authored
chore: Cleanup backup resizing (#11137)
It's been plenty of time since this migration was merged. We can remove it now that every node should have the full sized backup.
1 parent d6d2011 commit 51ddfcf

2 files changed

Lines changed: 7 additions & 24 deletions

File tree

ic-os/components/guestos/init/setup-lvs/setup-lvs.sh

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
6557
lvs /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.
8070
lvs /dev/store/shared-swap >/dev/null 2>&1 || (
8171
echo "Logical volume 'shared-swap' does not exist yet (first boot?), creating it."

ic-os/components/upgrade/shared-resources/setup-shared-resources/setup-shared-backup.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ set -e
55
blkid /dev/mapper/store-shared--backup >/dev/null || (
66
mkfs.ext4 /dev/mapper/store-shared--backup
77
)
8-
9-
# TODO(NODE-1722): remove once every GuestOS has been upgraded after the LV resize
10-
# NOTE: e2fsck will exit non-zero if errors are fixed. Rather than handle these
11-
# cases (1, 2), ignore them, and let any real errors fall to the resize or
12-
# later mount.
13-
e2fsck -pf /dev/mapper/store-shared--backup || true
14-
resize2fs /dev/mapper/store-shared--backup

0 commit comments

Comments
 (0)