Simulate bitrot/corrupt files (for BTRFS)

btrfscorruption

Is it possible to intentionally corrupt a file so that BTRFS will report a checksum error? I want to test a script that's supposed to find file names with checksum errors, but I don't have any corrupt files.

EDIT: After a long time of searching I found the same question on AskUbuntu with some solutions. Unfortunately, I don't see any btrfs-corrupt-block utility, despite the fact that I have btrfs-progs installed.

Best Answer

That the btrfs-corrupt-block is not in the btrfs-progs packages is probably because the developers did not want the average user to accidentally start it and corrupt anything. The program is not a target in the btrfs-progs' Makefile and would not be compiled and included by a package builder unless they applied a distro specific patch first. The program is more of a testing tool for developers of btrfs.

The source however is in the main repository, you can just check that out and compile it.

Related Question