Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have found some problem in my server, here it is:

df -H | columt -t

  Filesystem                    Size  Used  Avail  Use%  Mounted on
  /dev/mapper/vg_test-lv_home   212G  177G  25G    88%   /home

du -sh /home/

  59G   /home/

Does someone know why my /home/ consume 59G space, but vg_test_lv_home have used 177G space, it does not make sense, right?

share|improve this question
    
Is there any reason you're using the -H option to df but not using the --si option for du? –  Ladadadada Jul 29 '13 at 14:13

2 Answers 2

up vote 1 down vote accepted

difference between du and df

  • du compute only what they can see, based on filesystem entries...
  • df inquire filesytem meta datas

Deleted but not closed entries

There could be deleted entries that stay owned by running process.

(
    (
        dd if=/dev/zero count=102400
        sleep 5 ) >test.img  &
    sleep 1
    ls -l test.img
    df -k .
    du -xks /home
    rm -v test.img
    df -k .
    du -xks /home
    sleep 5
    df -k .
    du -xks /home
) 2>/dev/null
-rw-r--r-- 1 user user 52428800 Jul 28 18:51 test.img
Filesystem            1K-blocks    Used Available Use% Mounted on
/dev/mapper/MyRX-HOME  10321208 7560824   2236096  78% /home
7159956     /home
removed `test.img'
Filesystem            1K-blocks    Used Available Use% Mounted on
/dev/mapper/MyRX-HOME  10321208 7560824   2236096  78% /home
7108756     /home
Filesystem            1K-blocks    Used Available Use% Mounted on
/dev/mapper/MyRX-HOME  10321208 7509472   2287448  77% /home
7108756     /home

While file is removed, used space stay at 7560824, and return to 7509472 once first sleep 5 finish (and redirected process finish).

Reserved block for sysadmin

There could be reservation by the filesystem (depending on which filesystem is used and how it is configured).

dumpe2fs -h /dev/mapper/vg_test-lv_home
share|improve this answer
    
you are right,the running process hold the deleted file,/proc/12373/fd/1 -> /home/data/nohup.out (deleted) –  user2621991 Jul 29 '13 at 3:16
    
If I'm right please valid the answer. –  F. Hauri Jul 29 '13 at 8:44

It makes sense if the logical volume has been resized, but the underlying filesystem hasn't.

Try to run:

# resize2fs /dev/mapper/vg_test-lv_home

And then check again if the reported sizes match.

share|improve this answer
    
l haven't resized lvm –  user2621991 Jul 29 '13 at 3:18

Your Answer

 
discard

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.