Wednesday, September 3, 2014

hard drive - Linux different size for df and du for root partition



On my CentOS server, both of the commands are showing different usage for disk / , df shows this output:



Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda2 16G 14G 952M 94% /
/dev/xvda6 996M 258M 687M 28% /tmp
/dev/xvda3 16G 6.5G 8.3G 45% /var
/dev/xvda1 251M 25M 213M 11% /boot

tmpfs 4.0G 0 4.0G 0% /dev/shm


and du -sh shows



6.9M    /bin/
15M /boot/
123M /etc
212K /home/
233M /lib

27M /lib64/
16K /lost+found/
8.0K /media/
8.0K /mnt/
399M /opt/
959M /root/
35M /sbin/
8.0K /srv/
0 /sys/
2.5G /usr/

4.2G total


Also tried with NCDU tool, which reports only 5.6GB usage.



How to find hidden disk space?


Answer



See if you have any deleted files still in use



lsof | grep deleted


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...