8

Df -h is showing a wrong empty space on my server, for one of the disks:

/dev/sda2   450G    393G    34G     93%     /

Cpanel shows that it has only 34GB free, but there is a lot more. A few minutes ago, I removed over 80GB of log files. So, I'm sure its completly wrong.

fdisk -l /dev/sda2 also shows something wrong:

Disk /dev/sda2: 498.0 GB, 498098280960 bytes
255 heads, 63 sectors/track, 60557 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda2 doesn't contain a valid partition table

What can I do to solve this without formating?

valter
  • 689
  • 5
  • 13
  • 23

2 Answers2

6

Between you and df, I'll trust df.

The filesystem on /dev/sda2 can store 450GB, currently divided thus:

  • 393GB used
  • 34GB free
  • 22.5GB free, but reserved for root, so not counted in the free column

The space reserved for root is 5% by default (and clearly your system uses the default since the number match), you can change that with tune2fs but I don't recommend it unless you know what you're doing.

fdisk -l /dev/sda2 not containing a partition table is to be expected. After all, /dev/sda2 is a partition. The partition table is on the disk, /dev/sda.

The size of the partition /dev/sda2 is 498098280960 bytes. The size of the filesystem is about 450*1024*1024*1024 = 483183820800. Either that's almost 14GB in filesystem data structures (which is a little more than I'd expect, I have ~8GB on a similarly-size filesystem here, but maybe you allowed a lot of inodes).

So the only thing that may be a problem is the 80GB of logs you think you deleted. Are you sure they were all on this filesystem? Could some of them have remaining hard links?

  • reserved size does not seems to be a root of the problem here, OP asked about 80G deleted log file. But anyway, +1 for the fist sentence :) – rvs Apr 28 '11 at 18:20
5

You say you removed the logfiles, but did you ensure the programs writing those logfiles weren't still writing to them?

A file can be removed from it's directory and will still exist if a process is still writing to it. That process could later quite validly link the file into some other directory (or the same one it was in before)... and the open file descriptor is all it needs to work with to be able to do that.

So... use "lsof" and look for deleted files. Restart services which were writing to the logfiles and you'll most probably see the space come available.

pbr
  • 206
  • 1
  • 3