Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
                       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?

share|improve this question

Run du -sh / and compare what returns to your df -h output. I would bet there's a big difference in used space.

Reboot the server or kill off any processes that have the files that you deleted open. There are probably open file descriptors that are keeping the space marked as unavailable. Check lsof |grep /volume (where volume is the volume that you want to inspect) or just lsof +L1 and you will likely see the files that you deleted are still considered open.

I hate to suggest "just reboot it" but if there are a lot of open file descriptors, that's probably the easiest way.

share|improve this answer
You are a life saver David. "du -sh /" gave the same results, but a restart did the trick. Used space is now 6.3 GB. – Cory Gagliardi Apr 13 '12 at 4:59
@CoryGagliardi Lifesaving. It's all part of the services I offer. =) Don't forget to mark the answer for the benefit of future readers. – Wesley Apr 13 '12 at 5:00

Worked on Redhat 6.

Flush the file system device's buffer caches before beginning.

resize2fs -F

Extend and resize:

lvextend -L4G /dev/$VGNAME/$LVNAME

resize2fs -F /dev/$VGNAME/$LVNAME

share|improve this answer
The resize wasn't the issue for me. It was after I consumed the space, then deleted that data, it wasn't available. This probably had nothing to do with extending the file system, but rather I just needed to restart to fully free up the data that was in use. – Cory Gagliardi May 13 '12 at 3:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.