From aa660876859acaca09e1ed1e7a7ff08afa36f395 Mon Sep 17 00:00:00 2001 From: Randy Bush Date: Sat, 3 Oct 2020 20:15:41 -0700 Subject: [PATCH] use backup/resore --- pages/ShrinkLinuxDisk.md | 51 +++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/pages/ShrinkLinuxDisk.md b/pages/ShrinkLinuxDisk.md index ba4aa51..d624639 100644 --- a/pages/ShrinkLinuxDisk.md +++ b/pages/ShrinkLinuxDisk.md @@ -10,21 +10,46 @@ Shutdown the VM gnt-instance shutdown rpki.dfw.rg.net ``` -We need to get the uuid of the volume to be reduced - -``` -# gnt-instance info rpki.dfw.rg.net | grep primary - - primary: vm3.dfw.rg.net - on primary: /dev/ganeti/a5ce213c-d455-4cee-a173-4c3c72d81e68.disk0_data (253:10) - on primary: /dev/ganeti/a5ce213c-d455-4cee-a173-4c3c72d81e68.disk0_meta (253:12) -``` - -Oops! See that disk0_meta? This means there is a drbd secondary. We never figured out how to deal with that, so you have to convert the instance to plain before proceeding. +Make sure the VM is not DRBD mirrored. If it is, then ``` gnt-instance modify -t plain --no-wait-for-sync rpki.dfw.rg.net ``` + +## Shrink the partition(s) + +Use a gparted bootable iso or a Linux live bootable iso to run +`gparted` to shrink the partitions. + + +## Backup the instance + +Make sure the destination node has sufficient space. If not, on the +destination node, you can + +``` +lvextend -L +128G /dev/mapper/ganeti-var +resize2fs /dev/mapper/ganeti-var +``` + +Then + +``` +gnt-backup export -n vm3 rpki.dfw.rg.net +``` + +## Restore into Smaller Space + +``` +gnt-backup import -n vm0 --src-node=vm3 --disk 0:size=21G -t plain rpki.dfw.rg.net +``` + +## And you should be good to go + + +# SKIP THE REST OF THIS!!! The above is the hack you want + ## Tell Ganeti to Chill First we need to stop ganeti and backup the config file on the master @@ -80,4 +105,8 @@ gnt-instance modify -t drbd --no-wait-for-sync -n vm2 rpki.dfw.rg.net gnt-instance start rpki.dfw.rg.net ``` -And Bob's your uncle. \ No newline at end of file +And Bob's your uncle. + +--- + +2020.10.03 \ No newline at end of file