1bup-damage(1) bup-damage(1)
2
3
4
6 bup-damage - randomly destroy blocks of a file
7
9 bup damage [-n count] [-s maxsize] [--percent pct] [-S seed] [--equal]
10 <filenames...>
11
13 Use bup damage to deliberately destroy blocks in a .pack or .idx file
14 (from .bup/objects/pack) to test the recovery features of bup-fsck(1)
15 or other programs.
16
17 THIS PROGRAM IS EXTREMELY DANGEROUS AND WILL DESTROY YOUR DATA
18
19 bup damage is primarily useful for automated or manual tests of data
20 recovery tools, to reassure yourself that the tools actually work.
21
23 -n, --num=numblocks
24 the number of separate blocks to damage in each file (default
25 10). Note that it's possible for more than one damaged segment
26 to fall in the same bup-fsck(1) recovery block, so you might not
27 damage as many recovery blocks as you expect. If this is a
28 problem, use --equal.
29
30 -s, --size=maxblocksize
31 the maximum size, in bytes, of each damaged block (default 1 un‐
32 less --percent is specified). Note that because of the way
33 bup-fsck(1) works, a multi-byte block could fall on the boundary
34 between two recovery blocks, and thus damaging two separate re‐
35 covery blocks. In small files, it's also possible for a damaged
36 block to be larger than a recovery block. If these issues might
37 be a problem, you should use the default damage size of one
38 byte.
39
40 --percent=maxblockpercent
41 the maximum size, in percent of the original file, of each dam‐
42 aged block. If both --size and --percent are given, the maximum
43 block size is the minimum of the two restrictions. You can use
44 this to ensure that a given block will never damage more than
45 one or two git-fsck(1) recovery blocks.
46
47 -S, --seed=randomseed
48 seed the random number generator with the given value. If you
49 use this option, your tests will be repeatable, since the dam‐
50 aged block offsets, sizes, and contents will be the same every
51 time. By default, the random numbers are different every time
52 (so you can run tests in a loop and repeatedly test with differ‐
53 ent damage each time).
54
55 --equal
56 instead of choosing random offsets for each damaged block, space
57 the blocks equally throughout the file, starting at offset 0.
58 If you also choose a correct maximum block size, this can guar‐
59 antee that any given damage block never damages more than one
60 git-fsck(1) recovery block. (This is also guaranteed if you use
61 -s 1.)
62
64 # make a backup in case things go horribly wrong
65 cp -pPR ~/.bup/objects/pack ~/bup-packs.bak
66
67 # generate recovery blocks for all packs
68 bup fsck -g
69
70 # deliberately damage the packs
71 bup damage -n 10 -s 1 -S 0 ~/.bup/objects/pack/*.{pack,idx}
72
73 # recover from the damage
74 bup fsck -r
75
77 bup-fsck(1), par2(1)
78
80 Part of the bup(1) suite.
81
83 Avery Pennarun <apenwarr@gmail.com>.
84
85
86
87Bup 0.29.1 2017-03-26 bup-damage(1)