logoalt Hacker News

cosmic_cheesetoday at 12:20 AM2 repliesview on HN

I recall there being some techno-mysticism surrounding defragging regarding how often and when it was necessary, what it did and didn’t help, etc. I also remember the claim “Macs don’t need defragging” but I don’t know if HFS(+) was actually any less prone to fragmentation than FAT32 was. Companies like Symantec were happy to sell defragging tools to Mac users regardless.


Replies

toast0today at 4:50 AM

Wikipedia claims [1]:

> The HFS Plus file system transparently defragments files that are less than 20 MiB in size and are broken into 8 or more fragments when the file is being opened.

Which I expect would have significantly reduced the need to defrag and thus reduced the joy of computing. :p

[1] https://en.wikipedia.org/wiki/File_system_fragmentation

suprjamitoday at 2:05 AM

People used to say the same about Linux ext4, it didn't need defragmenting.

afaics all that meant was file allocations make a little extra space at the end, so if the file expands it doesn't need to allocate a new block.

If one keeps files around for a long time and constantly adds to them, then the files get fragmented on any filesystem.

The only way to avoid this is pre-allocate all files to their maximum possible size and never exceed that size.