]> git.cworth.org Git - tar/blob - doc/tar-snapshot-edit.texi
9c01a4ae35b5aed81b5fec44c1c31701e450f378
[tar] / doc / tar-snapshot-edit.texi
1 @c This is part of the paxutils manual.
2 @c Copyright (C) 2007 Free Software Foundation, Inc.
3 @c This file is distributed under GFDL 1.1 or any later version
4 @c published by the Free Software Foundation.
5
6 @cindex Device numbers, changing
7 @cindex snapshot files, editing
8 @cindex snapshot files, fixing device numbers
9   Sometimes device numbers can change after upgrading your kernel
10 version or recofiguring the harvare.  Reportedly this is the case with 
11 some newer @i{Linux} kernels, when using @acronym{LVM}.  In majority of
12 cases this change is unnoticed by the users.  However, it influences
13 @command{tar} incremental backups: the device number is stored in tar
14 snapshot files (@pxref{Snapshot Files}) and is used to determine whether
15 the file has changed since the last backup.  If the device numbers
16 change for some reason, the next backup you run will be a full backup.
17
18 @pindex tar-snapshot-edit
19   To minimize the impact in these cases, GNU @command{tar} comes with
20 the @command{tar-snapshot-edit} utility for inspecting and updating
21 device numbers in snapshot files.  The utility, written by
22 Dustin J.@: Mitchell, is available from
23 @uref{http://www.gnu.org/@/software/@/tar/@/utils/@/tar-snapshot-edit.html,
24 @GNUTAR{} home page}. 
25
26   To obtain the device numbers used in the snapshot file, run 
27
28 @smallexample
29 $ @kbd{tar-snapshot-edit @var{snapfile}}
30 @end smallexample
31
32 @noindent
33 where @var{snapfile} is the name of the snapshot file (you can supply as many
34 files as you wish in a single command line ).
35
36 To update all occurrences of the given device number in the file, use
37 @option{-r} option.  It takes a single argument of the form
38 @samp{@var{olddev}-@var{newdev}},  where @var{olddev} is the device number
39 used in the snapshot file, and @var{newdev} is the corresponding new device
40 number.  Both numbers may be specified in hex (e.g., @samp{0xfe01}),
41 decimal (e.g., @samp{65025}), or as a major:minor number pair (e.g.,
42 @samp{254:1}).  To change several device numbers at once, specify them
43 in a single comma-separated list, as in
44 @option{-r 0x3060-0x4500,0x307-0x4600}.
45
46 Before updating the snapshot file, it is a good idea to create a backup
47 copy of it.  This is accomplished by @samp{-b} option.  The name of the
48 backup file is obtained by appending @samp{~} to the original file name.
49
50 An example session:
51 @smallexample
52 $ @kbd{tar-snapshot-edit /var/backup/snap.a}
53 file version 2
54 /tmp/snap: Device 0x0306 occurs 634 times.
55 $ @kbd{tar-snapshot-edit -b -r 0x0306-0x4500 /var/backup/snap.a}
56 file version 2
57 @end smallexample
58