Sample Header Ad - 728x90

I observe using `dd if=filein of=fileout` lead to filesystem fragmentation, what do I have to change?

6 votes
1 answer
445 views
There was a nice question that sadly got deleted while I was writing a rather extensive answer :( Not wanting to let that effort go to waste, let me paraphrase that question from the question text and comments: > I observe that using dd to overwrite files does increase fragmentation. I'm looking for an alternative to dd that doesn't lead to fragmentation. > > As an example for how that fragmentation happens: imagine a file which occupies the entire filesystem. Start overwriting it, you'll immediately see how the partition becomes completely "free", and you'll be able to write another file to it in the meantime. Blocks are allocated dynamically and there's zero guarantee older blocks will be reused when the file gets overwritten. > > I observe this behaviour on multiple file systems (ext2, 3 and 4, XFS, as well as FAT32 and NTFS) and on multiple OSes (win95 through modern Fedora)². > > I'm convinced this is independent of FS and OS. > > My main file system is a Bog standard ext4. FedoraROOT: 103874/1310720 files (0.2% non-contiguous), 1754833/5242880 blocks. Minimum overall fragmentation. --- note that *I* myself cannot observe this, I'm trusting the original asker on these fragmentation claims!
Asked by Marcus Müller (47107 rep)
Jun 11, 2022, 03:08 PM
Last activity: Jun 11, 2022, 06:38 PM