.TH bup\-damage 1 "2013\-12\-16" "Bup debian/0.25\-1" .SH NAME .PP bup\-damage \- randomly destroy blocks of a file .SH SYNOPSIS .PP bup damage [\-n count][\-s maxsize] [\-\-percent pct][\-S seed] [\-\-equal] .SH DESCRIPTION .PP Use \f[C]bup\ damage\f[] to deliberately destroy blocks in a \f[C]\&.pack\f[] or \f[C]\&.idx\f[] file (from \f[C]\&.bup/objects/pack\f[]) to test the recovery features of \f[C]bup\-fsck\f[](1) or other programs. .PP \f[I]THIS PROGRAM IS EXTREMELY DANGEROUS AND WILL DESTROY YOUR DATA\f[] .PP \f[C]bup\ damage\f[] is primarily useful for automated or manual tests of data recovery tools, to reassure yourself that the tools actually work. .SH OPTIONS .TP .B \-n, \-\-num=\f[I]numblocks\f[] the number of separate blocks to damage in each file (default 10). Note that it\[aq]s possible for more than one damaged segment to fall in the same \f[C]bup\-fsck\f[](1) recovery block, so you might not damage as many recovery blocks as you expect. If this is a problem, use \f[C]\-\-equal\f[]. .RS .RE .TP .B \-s, \-\-size=\f[I]maxblocksize\f[] the maximum size, in bytes, of each damaged block (default 1 unless \f[C]\-\-percent\f[] is specified). Note that because of the way \f[C]bup\-fsck\f[](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\[aq]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. .RS .RE .TP .B \-\-percent=\f[I]maxblockpercent\f[] the maximum size, in percent of the original file, of each damaged block. If both \f[C]\-\-size\f[] and \f[C]\-\-percent\f[] 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 \f[C]git\-fsck\f[](1) recovery blocks. .RS .RE .TP .B \-S, \-\-seed=\f[I]randomseed\f[] seed the random number generator with the given value. If you use this option, your tests will be repeatable, since the damaged block offsets, sizes, and contents will be the same every time. By default, the random numbers are different every time (so you can run tests in a loop and repeatedly test with different damage each time). .RS .RE .TP .B \-\-equal instead of choosing random offsets for each damaged block, space the blocks equally throughout the file, starting at offset 0. If you also choose a correct maximum block size, this can guarantee that any given damage block never damages more than one \f[C]git\-fsck\f[](1) recovery block. (This is also guaranteed if you use \f[C]\-s\ 1\f[].) .RS .RE .SH EXAMPLE .IP .nf \f[C] #\ make\ a\ backup\ in\ case\ things\ go\ horribly\ wrong cp\ \-a\ ~/.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 \f[] .fi .SH SEE ALSO .PP \f[C]bup\-fsck\f[](1), \f[C]par2\f[](1) .SH BUP .PP Part of the \f[C]bup\f[](1) suite. .SH AUTHORS Avery Pennarun .