DON'T perform this unless absolutely necessary!
AND
Make sure you have a system BACKUP!
1. Add new disk of the desired (target) size to the vm
2. Shutdown and boot into systemrescuecd
3. New device should be listed, let's check that:
lsblk
4. Start by > shrinking the partition(s) of disk(s) you would like to downsize
5. Create a clone of the larger disk into smaller disk that was just added:
Depending on the size of your data, this may take some time
dd if=/dev/sdX of=/dev/sdY bs=$block-size status=progress
Be VERY careful here, IF is a SOURCE, OF is a DESTINATION, BS is a BLOCK SIZE (query this of your VM provider), STATUS is PROGRESS (to monitor the progress)
6. Once complete, verify the partitions on a new drive:
gdisk -l /dev/sdY
If you encounter Warning! Disk size is smaller than the main header indicates!
To fix it:
gdisk /dev/sdY
> x (experts mode)
> e (to relocate backup partition table to the end of the disk)
> w (to write changes)
> confirm
7. > Extend the partition on a new disk if possible
8. Shutdown the vm
9. Swap the disks (to boot of the smaller clone)
10. Boot
11. Delete old (larger) disk
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article