Run outputs moved to logs/ (incl. sda partition-table backup). New from the 15:57-16:03 parallel session: 16-grow-root-online.sh (RAN: / = 431G online, swap removed by design — GROW-ROOT-RUNBOOK superseded) and 15-docker-to-data2.sh (staged, not run). README/NEXT/RUNBOOK/REBUILD reflect current reality. Moot rdp-testprep timer removed from the VM. Details: https://projects.knownelement.com/issues/615
3.7 KiB
Manual runbook: grow / from 279G to ~505G (VM 5111, ultix-streaming)
SUPERSEDED 2026-09-01 16:03: done ONLINE, no reboot, by
16-grow-root-online.sh(parallel crush session) — / is 431G, swap removed by design, partition-table backup in logs/ and /root/. Kept below for the manual rollback procedure only.
YOU run every command, one at a time, checking the output before the next. Nothing here is automated, scheduled, or boot-triggered. Storage ops are the only steps in this whole effort that no script touches.
Layout change
before: sda1 root 279.2G | sda2 extended [ sda5 swap 8.8G ] | ~150G unallocated
after: sda1 root ~505G | sda2 swap ~13G (new, at the tail)
MBR stays MBR, ext4 grows online, VM stays up the whole time. You can safely stop after any step; the system runs fine at any intermediate size. Takes about 10 minutes end to end.
Step 0 — preconditions
command -v growpart || sudo apt-get install -y cloud-guest-utils
df -h / /data1 /data2 # know your starting point
lsblk /dev/sda
Step 1 — backups (30 seconds, do not skip)
sudo sfdisk --dump /dev/sda | sudo tee /root/sda.sfdisk.bak.$(date +%F)
sudo cp /etc/fstab /root/fstab.bak.$(date +%F)
Check: head /root/sda.sfdisk.bak.* lists sda1, sda2, sda5.
Step 2 — grow the virtual disk at the host (hot, VM stays up)
ssh root@pfv-tsys5.knel.net 'qm config 5111 | grep scsi0' # eyeball the target
ssh root@pfv-tsys5.knel.net 'qm resize 5111 scsi0 +80G'
Check in guest: lsblk /dev/sda shows sda = 518G, sda1 still 279.2G.
Step 3 — retire the old swap
free -h # swap "used" must be ~0
sudo swapoff /dev/sda5
OLDUUID=$(sudo blkid -s UUID -o value /dev/sda5); echo "OLDUUID=$OLDUUID"
cat /proc/swaps # check: empty
Step 4 — remove the extended partition (the strip between root and free space)
sudo sfdisk --delete /dev/sda 2
sudo partprobe /dev/sda
lsblk /dev/sda
Check: only sda1 remains. If sda1 is missing: STOP, do not reboot, do not
write anything; restore the table:
sudo sfdisk /dev/sda < /root/sda.sfdisk.bak.<date>
Step 5 — grow partition 1 into the free space
sudo growpart /dev/sda 1
# parted alternative: sudo parted /dev/sda resizepart 1 100%
lsblk /dev/sda # sda1 now ~505G
Step 6 — grow the filesystem (online)
sudo resize2fs /dev/sda1
df -h / # ~500G available
Step 7 — new swap at the tail
sudo parted -s /dev/sda mkpart primary linux-swap 505GB 100%
sudo partprobe /dev/sda
lsblk /dev/sda
NEWSWAP=$(lsblk -no NAME,TYPE /dev/sda | awk '$2=="part"{print $1}' | tail -1); echo "NEWSWAP=$NEWSWAP"
sudo mkswap /dev/$NEWSWAP
NEWUUID=$(sudo blkid -s UUID -o value /dev/$NEWSWAP); echo "NEWUUID=$NEWUUID"
Step 8 — swap fstab line, activate
sudo sed -i "s/^UUID=$OLDUUID/#UUID=$OLDUUID retired-sda5 $(date +%F)/" /etc/fstab
echo "UUID=$NEWUUID none swap sw 0 0" | sudo tee -a /etc/fstab
sudo swapon -a
cat /proc/swaps # new swap active
sudo fstrim -v / # optional: reclaim (discard is on now)
Rollback map
- Anytime before step 4: nothing changed except two backup files.
- After partition edits, before resize2fs: restore table from the sfdisk dump (step 4 note); no data has moved, only the table.
- After resize2fs: growth is one-way by design; reverting size means restore from backups, so this is the one step to do when calm. (It is also the safest operation in the list: online ext4 grow is journaled.)
- fstab: backups in /root; only the swap line changes, and a bad swap line is non-fatal at boot (root entry is untouched).