4 ms·
I hadn't thought about defragging a hard drive in years. What happens on mobile OS? Do they run routine defrag processes in the background?
by fumar 5y ago
I hadn't thought about defragging a hard drive in years. What happens on mobile OS? Do they run routine defrag processes in the background?
- anyfoo 5y agoFor a few decades now, suitable filesystems work in a way that makes defragmentation essentially unnecessary. I don't you ever really had to defragment on Linux, by the time it came into existence its filesystem was already advanced enough (though I know nothing about ext, which existed briefly before ext2, and neither about the minix filesystem that Linux used briefly even before).
- JaimeThompson 5y agoYou should give "How to Fragment Your File System" by a lot of people a read. http://csis.pace.edu/~jyuan2/paper/betrfs5.pdf http://csis.pace.edu/~jyuan2/paper/betrfs5.pdf "In this article, we demonstrate that modern file systems can still suffer from fragmentation under representative workloads, and we describe a simple method for quickly inducing aging. Our results suggest that fragmentation can be a first-order performance concern—some file systems slow down by over 20x over the course of our experiments. We show that fragmentation causes performance declines on both hard drives and SSDs, when there is plentiful cache available, and even on large disks with ample free space."
- anyfoo 5y agoGuess I was myself part of what the second sentence mentions: "System implementers and users alike treat aging as a solved problem." :)
- KennyBlanken 5y agoThe web is full of people shouting "_____ filesytem doesn't get fragmented!" Apparently they've never let a filesystem get above 70% full or so, especially one on a fileserver that has seen years of daily use by a dozen+ people. I've heard it for HFS, HFS+, XFS, ext3, ext4, etc and every time it was an lie. Every filesystem fragments after regular use unless you have a fuckton of free space. It's pretty hard to justify to one's bosses over-provisioning disk space to enough of a degree to render fragmentation unlikely, and users just expand their data to fit it anyway.
- sumtechguy 5y ago2,281 extents found hmm that does not seem right and off by an order 10x...
- ReaLNero 5y agoThere is a background cleanup process for SSDs called trim, but it does something different. I mean magnetic hard drives are very similar to vinyl recordings, so it's clear why contiguous file placement has lower latency, and thus why defragmentation is a big performance boost. I believe since SSDs are organized differently (many NAND chips), their access latency doesn't benefit as much from a contiguous file placement. Furthermore, defrag necessarily has to write. Since SSD cells have a finite number of writes before they do not retain data, defragmentation shortens your SSD's lifecycle.
- pkaye 5y agoSSDs have their own logical to physical mapping tables. When you trim, it is telling the SSD you no longer care about that entry in the table so the physical space can be freed up. In terms of latency there is no seek time difference from one location to another hence defrag has no benefit. In fact defrag will just cause more wear.
- jeffbee 5y agoFragmentation is even beneficial in SSDs. When the contents of a logical file are physically scattered, the internal parallelism of many flash devices can be exploited. If your file are physically compact, you'd lose that parallelism.
- pkaye 5y agoI used to work on SSD FTL so have some ideas on the internals. Generally the writes are stripped across the flash devices. Main thing is you need command queueing to exploit the parallelism. You can do a few tricks like stride detection to prefetch in some cases because it makes the benchmarks look good.
- flatiron 5y agoDefragging puts files in a line so a spinning disc with a magnetic head can read it cleanly with one swipe. You phone works simple by asking for data from addresses. Not saying it’s perfect. Files can be fragmented so you may send a few more requests to get them. But it’s not something to lose sleep or run a utility on.
- stjohnswarts 5y agoYeah I think it's more import to keep your space under roughly 85-90% of your storage max size.