[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C. Fixing Snapshot Files

Sometimes device numbers can change after upgrading your kernel version or reconfiguring the hardware. Reportedly this is the case with some newer Linux kernels, when using LVM. In majority of cases this change is unnoticed by the users. However, it influences tar incremental backups: the device number is stored in tar snapshot files (see section Format of the Incremental Snapshot Files) and is used to determine whether the file has changed since the last backup. If the device numbers change for some reason, the next backup you run will be a full backup.

To minimize the impact in these cases, GNU tar comes with the tar-snapshot-edit utility for inspecting and updating device numbers in snapshot files. The utility, written by Dustin J. Mitchell, is available from GNU tar home page.

To obtain the device numbers used in the snapshot file, run

 
$ tar-snapshot-edit snapfile

where snapfile is the name of the snapshot file (you can supply as many files as you wish in a single command line).

To update all occurrences of the given device number in the file, use ‘-r’ option. It takes a single argument of the form ‘olddev-newdev’, where olddev is the device number used in the snapshot file, and newdev is the corresponding new device number. Both numbers may be specified in hex (e.g., ‘0xfe01’), decimal (e.g., ‘65025’), or as a major:minor number pair (e.g., ‘254:1’). To change several device numbers at once, specify them in a single comma-separated list, as in ‘-r 0x3060-0x4500,0x307-0x4600’.

Before updating the snapshot file, it is a good idea to create a backup copy of it. This is accomplished by ‘-b’ option. The name of the backup file is obtained by appending ‘~’ to the original file name.

An example session:

 
$ tar-snapshot-edit /var/backup/snap.a
file version 2
/tmp/snap: Device 0x0306 occurs 634 times.
$ tar-snapshot-edit -b -r 0x0306-0x4500 /var/backup/snap.a
file version 2

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Sergey Poznyakoff on March, 12 2011 using texi2html 1.78.