LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Missing space on empty partition (https://www.linuxquestions.org/questions/linux-newbie-8/missing-space-on-empty-partition-4175467799/)

AlligatorDundee 06-29-2013 04:20 AM

Missing space on empty partition
 
Hi,
I have a partition that I'm intending to use for general data storage. The partition size is 110 Gb. It previously had some files on, which I've now deleted - and yet nautilus and gparted are both showing 60 Gb as still used!
However, df correctly reports the partition as almost empty:
Code:

/dev/sda5            52373796    15032  52358764  1% /media/data
I've tried restarting, unmounting and remounting the partition, but no change and I'm not sure where to go now - any help appreciated.

Output from fdisk -l (the partition in question is sda5):
Code:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb5edc124

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1        392    3148708+  82  Linux swap / Solaris
/dev/sda3            393      30023  238009924+  5  Extended
/dev/sda5          15673      30023  115272259+  83  Linux
/dev/sda6            393        3917    28311552  83  Linux
/dev/sda7            3917      15673    94424064  83  Linux

Partition table entries are not in disk order


AlligatorDundee 06-29-2013 05:37 AM

Actually, df doesn't report correctly either. df shows the partition as being about 50 Gb in size; Gparted shows it as being 110 Gb, with 50 Gb free (natilus also shows 50 Gb free). Any ideas as to what's going on?

jazz5150 06-29-2013 05:45 AM

If you're sure you don't need anything on the partition: delete it and create a new one of the same size.
That should clear things up

edit:
Without physical access to the HD and not knowing its history I have no idea what's going on ..

Madhu Desai 06-29-2013 07:23 AM

Quote:

Originally Posted by AlligatorDundee (Post 4980671)
Partition table entries are not in disk order

Try this first:
Code:

# fdisk /dev/sda

Command (m for help): x

Expert command (m for help): f

Expert command (m for help): r

Command (m for help): w

And then, boot in rescue mode, and run fsck -y on all partitions.

Hope it will fix the problem.

AlligatorDundee 06-29-2013 01:15 PM

I decided to delete it and recreate the partition, as I thought that would be faster than running fsck on the whole drive. Reading a little, it seems like the problem may have been that I expanded the partition a while ago, but for some reason the file system didn't get expanded into the empty space. So the problem's probably been there for a while, but I only noticed it when I deleted everything. There seems to be a bug in GParted which makes it think the file system always fill the entire partition, so it was reporting 60 Gb used (= partition size of 110 Gb - free space of 50 GB).

Anyway - all sorted now, the new partition is properly empty (apart from the space for the inodes etc) so all is good, thanks!

syg00 06-29-2013 06:28 PM

You were misunderstanding what you were seeing.
df is only concerned with filesystems - if it was less than the partition size as you say, then df sees the total size and "free" only as it pertains to the filesystems. The partition-level tools (parted included) see unallocated space within the partition as free.

Unfortunate overloading of the terminology.

AlligatorDundee 06-30-2013 04:44 AM

You're correct about df, but I still think there's a bug in GParted: it was reporting 60 Gb within the partition as used, when it was not. There was 110 Gb of free space in the partition, of which 50 Gb was free space in the filesystem, and 60 Gb was space not allocated to the filesystem at all. GParted showed the latter as used - it would be much better if it showed it as it really is, ie. with the filesystem filling less than the whole partition.

I'm not sure how easy that would be to change, I've read on another thread that GParted calculates the used space by calling df to get the free space and then doing (partition size - free space) to get the used space. I can understand why it might do that (it's probably a lot faster than working out how much space is actually used by all the files?) but it can lead to confusion - as it did for me.


All times are GMT -5. The time now is 06:39 AM.