2021-02-06
bup-damage - randomly destroy blocks of a file
bup damage [-n count] [-s maxsize] [--percent pct] [-S seed] [--equal] <filenames…>
Use bup damage
to deliberately destroy blocks in a .pack
or .idx
file (from .bup/objects/pack
) to test the recovery features of bup-fsck
(1) or other programs.
THIS PROGRAM IS EXTREMELY DANGEROUS AND WILL DESTROY YOUR DATA
bup damage
is primarily useful for automated or manual tests of data recovery tools, to reassure yourself that the tools actually work.
bup-fsck
(1) recovery block, so you might not damage as many recovery blocks as you expect. If this is a problem, use --equal
.
--percent
is specified). Note that because of the way bup-fsck
(1) works, a multi-byte block could fall on the boundary between two recovery blocks, and thus damaging two separate recovery blocks. In small files, it’s also possible for a damaged block to be larger than a recovery block. If these issues might be a problem, you should use the default damage size of one byte.
--size
and --percent
are given, the maximum block size is the minimum of the two restrictions. You can use this to ensure that a given block will never damage more than one or two git-fsck
(1) recovery blocks.
git-fsck
(1) recovery block. (This is also guaranteed if you use -s 1
.)
# make a backup in case things go horribly wrong
cp -pPR ~/.bup/objects/pack ~/bup-packs.bak
# generate recovery blocks for all packs
bup fsck -g
# deliberately damage the packs
bup damage -n 10 -s 1 -S 0 ~/.bup/objects/pack/*.{pack,idx}
# recover from the damage
bup fsck -r
bup-fsck
(1), par2
(1)
Part of the bup
(1) suite.