How to get free space from mounted drive Redhat 7
Solution 1:
I try to do the same thing couple week ago and I don't find how to. I share the official statement on the Redhat support portal.
It is currently not possible to reduce the size of a partition or logical volume with the xfs filesystem. If you are interested in this functionality please contact Red Hat support and reference Red Hat bugzilla 1062667, and provide your use-case for needing XFS reduction / shrinking. As a possible workaround in some environments, thin provisioned LVM volumes can be considered as an additional layer below the XFS filesystem.
Good luck!!
Solution 2:
Being able to run fstrim on the / partitions would be the best solution however with they way your ESXi is configured it would not be possible.
You need to be able to enable discards on both the VM and the storage device.
Trying to reduce to size of a partition or logical volume with the xfs filesystem cannot be done this is a known bug with fedora. If you are interested in this functionality please contact Red Hat support and reference Red Hat bugzilla 1062667, and provide your use-case for needing XFS reduction / shrinking.
As a possible work around in some environments, thin provisioned LVM volumes can be considered as an additional layer below the XFS file system.
If the VM's are eager thick provisioned VMDK, which means that there is nothing to reclaim when you are attempting to trim (technically speaking; SCSI UNMAP) your volumes.
If the back-end storage is running thin provisioning then you also need to use lazy zeroed VMDK files in order to reduce the storage and make it possible for the backend to cache/dedup the warm data.
Two possible options:
When storage is provided by a remote server across a SAN, you can only discard blocks if the storage is thin provisioned.
- VMotion all the VM's to a different data store and use the built-in VMWare tools
- Connect to the ESXi Host with SSH
- Navigate to the Virtual Machine Folder
- Verify disk usage with du
- Run vmkfstools -K [disk]
- Verify disk usage with du
dd if=/dev/zero of=BIGFILE bs=1024000 rm -f BIGFILE
From what I can tell this does the same thing as sdelete however it can cause a spike in disk I/O as well as take a while to run.
Something to try overnight
Either option is not the best but reformatting every VM to get ext3 or ext4 does not sound feasible.
What you might be able to do is setup an affinity rule for all linux VM’s and use option 1 from above.