6

I have setup several drives in an Ubuntu 12.04 x64 machine by deleting all the partitions and formatting them as ext4 with fdisk, but when I ran df -h, it showed me that a substantial amount of the drive space had already been used up. For example, on my 1TB drive, it showed me that 14GB was already in use. I mounted the drive to a folder and went to examine it with ls -a and there are no files except for a directory lost+found that contains no files which really confuses me. Where are these 14GB "hiding"? I have tried re-partitioning it twice and un-mounting and then mounting again but no luck. Must I run dd to wipe the drive with /dev/null to regain those 14GB? If it is 100MB or so I would not complain, but 14GB is a lot of space.

user99545
  • 263
  • 1
  • 4
  • 6
  • It's just temporarily reserved for inodes. If you turn out not to need it, it will be reclaimed. It's inefficient to reserve space in small bits and pieces. – David Schwartz May 05 '12 at 22:51

1 Answers1

8

You could have reserved space for super-users.
This can be disabled via tune2fs -m 0 /dev/whatever - but the default for that would be 5%, and that doesn't really fit.

The partition does not only need to hold your data but also metadata (inodes!).
14GB used on a 1TB disk seems reasonable if you formated it with the default options.
If you are sure inodes are not a problem, you can try to reformat with the option mkfs.ext4 -T largefile (or largefile4) and see if it helps.

faker
  • 17,496
  • 2
  • 60
  • 70
  • The `mke2fs -t ext4 -T largefile` worked and shrunk it down to 300mb. Does this mean metadata will no longer be stored on that drive such as date/time? – user99545 May 05 '12 at 18:10
  • @user99545 no, this means that the preallocated reserve of these is shorter. – yrk May 05 '12 at 19:35
  • 1
    If you're not going to use the drive to store predominantly large files, using `-T largefile` will make inode allocation much less efficient as the drive gets full. You're *much* better off reserving more and then letting the system release it if doesn't need it than reserving too little and forcing the system to scrounge for fragments when the drive is full. – David Schwartz May 05 '12 at 22:52