5ccf9f236e0ff19caedf59fb79e949505a5344e3
[ikiwiki.git] / sandbox / testpage / index.mdwn
1 [[!toc  levels=3]]
2 # Introduction
3 The purpose of this document is to demonstarate to the reader how to restore data on a hammer 
4 filesystem(files/directories). This will also cover how to adjust history retention.
5
6 # Getting history records of a file
7
8 To get all history records of a file we will use hammer utility with 'history' command giving it 
9 file name as argument.
10
11         # echo "Hello" > test
12         # hammer history test
13         test    0000000110d66ec3 clean {
14            0000000110d6e970 04-Jan-2011 15:36:38
15         }
16
17         # echo "world" >> test
18         # hammer history test   
19         test    0000000110d66ec3 clean {
20            0000000110d6e970 04-Jan-2011 15:36:38
21            0000000110d6e9d0 04-Jan-2011 15:37:09
22         }
23
24         # echo "some more data" >> test
25         # hammer history test
26         test    0000000110d66ec3 clean {
27            0000000110d6e970 04-Jan-2011 15:36:38
28            0000000110d6e9d0 04-Jan-2011 15:37:09
29            0000000110d6ea10 04-Jan-2011 15:37:40
30         }
31
32 You probably wonder what are these strange hexadecimal numbers are:
33
34        0000000110d6e970
35            0000000110d6e9d0
36            0000000110d6ea10
37
38 Well, they are transaction ids. Transaction id is a 64 bit hexadecimal number used by hammer file 
39 system to refer to historical file or directory data.You will need them to restore file to a prior 
40 version.
41
42 #File restoring
43
44 To restore a file to a prior version we will use 'undo' utility. For example lets restore the test 
45 file to it's prior version created in previous section.
46
47         # hammer history test
48         test    0000000110d66ec3 clean { 
49            0000000110d6e970 04-Jan-2011 15:36:38
50            0000000110d6e9d0 04-Jan-2011 15:37:09
51            0000000110d6ea10 04-Jan-2011 15:37:40
52         }
53
54 Get data that refers to transaction id and put it in test.old
55
56         # undo -o test.old -t 0x0000000110d6e9d0 test
57         # cat test.old
58         Hello
59         world
60         # cat test
61         Hello
62         world
63         some more data
64
65 You can aslo specify the 'd' flag and get a diff output
66
67        # undo -d -o test.diff -t 0x0000000110d6e9d0 test
68        # cat test.diff
69        --- test@@0x000000110d6e9d0   2010-01-04 15:36:31 -0600
70        +++ test       2011-01-04 15:37:32 -0600
71        @@ -1,2 +1,3 @@
72         Hello
73         world
74        +some more data
75
76
77 ...