After using lvextend, I can't recover unused space
Posted
by
Cory Gagliardi
on Server Fault
See other posts from Server Fault
or by Cory Gagliardi
Published on 2012-04-13T04:02:42Z
Indexed on
2012/04/13
5:32 UTC
Read the original article
Hit count: 542
I needed to add more disk space to my CentOS VM, so I added another virtual disk, then used lvextend to add the space to the existing partition.
The steps I followed was:
echo "- - -" > /sys/class/scsi_host/host0/scan
pvcreate /dev/sdb
vgextend VolGroup00 /dev/sdb
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
resize2fs /dev/VolGroup00/LogVol00
This worked fine. I subsequently filled up the VM, then deleted most of the used disk space. However, the unused disk space was never recovered after I deleted all of the files.
This will illustrate what I'm saying better:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
61G 32G 26G 56% /
/dev/sda1 99M 20M 75M 21% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
# pwd; du -h --max-depth=0
/
5.1G .
I cannot figure out how to get the partition to see that only 5.1 GB is used. Any ideas what I'm doing wrong?
© Server Fault or respective owner