Ceph & squeeze ext4 VM disk

robertozappaterreni

New Member
Nov 3, 2022
11
1
3
hello,
I am facing a need, I have a virtual machine with 27TB of raw, and at the moment on it there are only 16TB occupied. My goal is to tighten the VM file system (lvm+ext4) and then tighten the raw so as to free 11TB for reuse for other applications.
In your opinion how is it possible to do this operation? I tried but I only found people who talk about ZFS my case is different:

VM:
OS. ubuntu 20.04
2 disks qcow2
- s.o. lvm ext4 32g
- lvm ext4 data 27000g

Storage where the 2 disks are is ceph replica 3
so are the discs in raw idea format?
 
First, does the disk image actually use all that space? You could try to run a rbd -p <pool> du to see how much space the disk image is using in Ceph. Maybe a fstrim -a inside the VM will clear up some space.

Otherwise, you need to first reduce everything inside the VM to a smaller size. Usually from the inside to the outside: Filesystem -> LV -> Partition
Live disk images like GParted can make the process easier.

Once you are sure that everything on the disk image has been sized down, you can resize the actual disk image. Ideally you leave some space, just in case some accounting is a bit wrong. See https://docs.ceph.com/en/quincy/rbd/rados-rbd-cmds/#decreasing-the-size-of-a-block-device-image for details on how to shrink an RBD image. You can use units like k, M, and G for the size.

Make sure you have a snapshot or backup before you start the procedure. Making it too small can lead to corrupted file systems and data loss!
 
  • Like
Reactions: robertozappaterreni