HydrogenAudio

Misc. => Off-Topic => Topic started by: simonh on 2010-10-22 19:09:58

Title: ext4 with journal
Post by: simonh on 2010-10-22 19:09:58
I recently bought a 1TB external drive. It was preformatted NTFS, and had 930GB available upon plugging in. As I use Linux, I formatted it to ext4 and it then had 870GB available. I assume the missing 60GB is used for the journal.

Does anyone know if I can reclaim that 60GB when the drive gets full. Or will it happen automatically? Or not at all?

Cheers
Title: ext4 with journal
Post by: Sebastian Mares on 2010-10-24 09:33:18
It will not happen automatically. Your missing space is caused by the journal and the reserved blocks. Have a look at the tune2fs -m switch and adapt the value of your drive if necessary. Theoretically you could even set that to 0, but I am not sure if that's a good idea.
Title: ext4 with journal
Post by: itisljar on 2010-11-23 11:03:51
If using it just as storage, why not formatting it as EXT2?
Title: ext4 with journal
Post by: Sebastian Mares on 2010-11-23 20:47:44
Well, I wouldn't... Unless you want to do a full HDD scan in case the drive was not plugged out correctly (which you would also have to do in case you disable the journal (or set it to 0 bytes) for ext3 / ext4).
Title: ext4 with journal
Post by: Garf on 2010-12-03 12:29:02
This is not only due to the journal (about 128M, certainly not several GB) and reserved space (by default 5%, or about 45G), but also due to the bookkeeping data (inodes), which is preallocated for ext4. NTFS does not preallocate it but assigns it on demand by expanding the MFT (which can then fragment, thereby degrading performance). You will also lose that diskspace on NTFS as you start adding more files.

There are other filesystems for Linux that do not preallocate (such as XFS and btrfs), but in general I wouldn't worry about it as this is really just a tradeoff between reserving space upfront or when it's needed.

A small advantage of allocating on demand is that if you would only put a few big files, you'd lose less space, and if you want to store a gazillion tiny files, you can run out of inodes. But again, for normal usage, the defaults are perfectly fine.