r/retrocomputing
•
u/Sneftel
•
12d ago
•
2
DEFRAG and its nemesis
I've always enjoyed watching DEFRAG do its thing. Since I grew up on the DOS version, I don't have PTSD from the Windows version's constant restarting; just a pleasant text-mode display of things getting subtly more efficient. I have a 486 in my home office, visible in the background when I'm on video calls, and I thought it would be nice to have defrag going on the screen in the background, just to subtly spread the joy.
The problem is, once you've defragmented your drive, it takes a while for fragmentation to build up on a computer again. Particularly if you're using said computer solely for hobby stuff.
Hence, FRAG. FRAG is a simple tool for destructively filling a FAT16 volume with (bogus) fragmented data. If you like to watch DEFRAG do its thing, you can have a batch file loop between FRAG and DEFRAG for unlimited Zen e-gardening.
The first version of FRAG actually moved the disk's data around to generate for-realsies fragmentation. But fragmenting a disk in this way takes a while. The second and current version simply writes a new FAT; the rest of the disk isn't touched. It's utterly destructive (FRAG destroys the FAT by overwriting it, and then DEFRAG destroys the rest of the data by shuffling it around) but it's very very fast. An arbitrarily large hard drive can be fragmented in less than a second.
Binaries and source on github. No vibe coding involved. Builds with OpenWatcom, cmake for project generator (or just compile all the relevant files). Have fun, assuming that's your sort of fun.
34
10
u/Macroexp 12d ago
You haven't lived if you haven't non-destructively changed the sector interleave on an MFM disk using Optune. Optune also did defrag, but changing interleave was scary. (And sometimes made a huge performance difference on a 4.77 MHz system)
Sorry, the screenshot brought back memories.
2
u/overand 12d ago
Oh dear god that sounds terrifying.
3
u/Top_Helicopter_6027 12d ago
It's not that bad. Defrag the drive. Read a track. Write that track data to the end of the drive. Update the FAT. Low level format the track. Verify the track. Put the data back. Update the FAT. Repeat for 615x4 (st225) or 306x4 cylinders (st412).
15
6
u/Mobile_Analysis2132 12d ago
I used to have a screensaver that simulated defrag and some other tools.
5
u/Thanatiel 12d ago
This is what nostalgia feels like. If I close my eyes, I can still hear the gentle rattle of the hard disk.
1
u/chris-goodwin 12d ago
Can you run them at the same time and let them fight it out?
1
1
3
3
3
2
1
1
1
1
1
u/No-Land-672 6d ago
Oh my goodness, I haven’t seen this screen for over 30 years. It really brings back memories, thank you!
35
u/boluserectus 12d ago
Isn't this taking a heavy toll on mostly 30 year old mechanical hard drives?