The command "df -h" no show me the size of partition true!

Iulian Musat iulian at 3dgeo.com
Mon Nov 8 19:23:46 UTC 2004


First try to see what is the sum of the sizes of all files.
For ex.:
find /home -type f -ls | perl -e 'while(<>){$s+=(split)[6];};print "$s\n";'

This will count all hidden files, including the ones from lost+found.

The number should be close to what how much space is used on disk.

If df shows a something way different you may want to run something like:
lsof | grep home

Look for some suspicious applications.

The idea is that if an application opens a file and the file is removed 
while the application keeps it open, the actual data is not removed from 
disk until the program exits or close the file.

My advice:
1. boot in single mode, recommended from a rescue disk so you have a 
'clean' kernel.
2. test du/find versus df output.
3. if different run fsck with -f and, if you can afford to wait, -c flags.
4. I think du/find should show similar numbers now (if it doesn't and 
you booted with a 'clean' kernel then I'll be interested for details)
5. reboot with the normal kernel
6. if df shows different than du then most likely you've been hacked - 
replace OS with a clean copy - try to find what programs are different 
than the original, etc.

Good luck.
-iulian
P.S.
Then again, it may be just a bad, wired piece of SCSI hardware (is this 
an external HDD?).

Alessandro Viana wrote:
> Hi,
> 
> I be the following problem: When I execute the command "df -h" the
> system show me the size from partition /home with 916MB Used. But, when
> I execute "du -h -s" the system show me only 231MB in use in /home.
> I am use Red Hat AS 2.1!
> 
> See you the problem below: (Look /home!)
> 
> [root at server1 root]# df -h
> Filesystem Size Used Avail Use% Mounted on
> /dev/sda2 2.0G 470M 1.4G 25% /
> /dev/sda1 152M 19M 125M 14% /boot
> /dev/sda10 19G 4.0G 13G 23% /data
> /dev/sda6 1.0G 916M 66M 94% /home
> /dev/sda9 4.9G 823M 3.8G 18% /opt
> none 2.0G 0 1.9G 0% /dev/shm
> /dev/sda7 1.0G 87M 895M 9% /tmp
> /dev/sda3 2.0G 946M 975M 50% /usr
> /dev/sda5 2.0G 665M 1.2G 35% /var
> tomate6:/backup/tomate1
> 166G 83G 75G 53% /backup
> 
> [root at server1 root]# du -h -s /home/
> 231M /home
> 
> Can somebody help me?
> 
> Alessandro.




More information about the redhat-list mailing list