SO
I am now the proud new owner of a 1TB hard disk. The reasons for this are long and complicated, especially as I don’t actually NEED more space, but I shan’t bore you with them.
ANYWAY I found a couple of interesting things out about using the ext3 filesystem and drive space. When I formatted the drive, it was showing a capacity of 916.9GiB and about 870GiB free. A 1TB disk is about 931GiB, so I felt I was robbed of 60GiB! This is a nontrivial amount. ext3 is responsible for this ‘lost’ space. I believe this information is true for ext4 as well. I am using ext3 as I need occasional access from Windows, and there exists a fairly good ext3 driver here, but 99% of access will be from Linux, and ntfs-3g is noticably slower than ext3, I find.
There are two factors explaining my missing space:
1) The filesystem reserves about 5% of the space for various reasons that are important to /, /tmp and /var (because the OS can fall over if these run out of space), and I think it handles fragmentation too, but my disk’s usage scenario is basically static storage, so reserving this space is pretty much unnecessary. And 5% of 1TB is pretty significant.
You can alter this on an existing formatted partition using:
# tune2fs -m 0 /dev/YOUR_PARTITION
(where 0 is percentage to reserve)
2) The filesystem by default allocates a large number of inodes1 per unit of storage space (I think it uses one inode per 4 KiB, but the documentation isn’t exactly rich with info). This is sensible because you don’t want to run out of space for your inodes, because you won’t be able to save any more files even though you might have a lot of free space. But how many you REALLY need depends on the average size of a file that will be stored on the disk. On an OS partition you will probably have a lot of fairly small files (utility programs, scripts, config files, temporary files, etc) and will need a lot of inodes. But on a backup/file storage disk, your average size is going to be much bigger, and all that inode reserved space is space you can’t use for data. To change this you can set the -T option when formatting, I don’t think there is any way to do it without reformatting. I used ‘-T largefile’, which I THINK equals 1 inode for every 1MiB of storage. You could also use largefile4 for 1 inode per 4MiB of storage space. Don’t use largefile for /home or any other OS partition, but you probably want it for disks which will purely store DATA (i.e. music, CD/DVD images, big digital camera photos, etc. And if you will also use it to back up a lot of documents or other files smaller than 1MiB, you could always tar up a bunch of them together).
You can set largefile as follows:
running this WILL reformat your partition, i.e. you will lose your data
# mkfs.ext3 -T largefile /dev/YOUR_PARTITION
(and adding “-m 0″ here would do the same as the above command)
And with that, I had 931GiB free of 931GiB. yay.
______
1. roughly: the filesystem has a space for your files, but it also needs to be able to look up WHERE a file is, as well as keeping track of things like date/time created, access, etc. and the size of the file, permissions, and so on, i.e. the ‘metadata’ about the file. An inode stores the information about a file which it is necessary for the filesystem to know. And there needs to be a big index of these on the filesystem.



