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

C. Fixing Snapshot Files

Various situations can cause device numbers to change: upgrading your kernel version, reconfiguring your hardware, loading kernel modules in a different order, using virtual volumes that are assembled dynamically (such as with LVM or RAID), hot-plugging drives (e.g. external USB or Firewire drives), etc. In the 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, by default 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 also available from the GNU tar home page.)

To obtain a summary of the device numbers found 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). You can then compare the numbers across snapshot files, or against those currently in use on the live filesystem (using ls -l or stat).

Assuming the device numbers have indeed changed, it's often possible to simply tell GNU tar to ignore the device number when processing the incremental snapshot files for these backups, using the ‘--no-check-device’ option (see device numbers).

Alternatively, you can use the tar-edit-snapshot script's ‘-r’ option to update all occurrences of the given device number in the snapshot file(s). 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 root_snap.0 boot_snap.0
File: root_snap.0
  Detected snapshot file version: 2

  Device 0x0000 occurs 1 times.
  Device 0x0003 occurs 1 times.
  Device 0x0005 occurs 1 times.
  Device 0x0013 occurs 1 times.
  Device 0x6801 occurs 1 times.
  Device 0x6803 occurs 6626 times.
  Device 0xfb00 occurs 1 times.

File: boot_snap.0
  Detected snapshot file version: 2

  Device 0x6801 occurs 3 times.
$ tar-snapshot-edit -b -r 0x6801-0x6901,0x6803-0x6903 root_snap.0 boot_snap.0
File: root_snap.0
  Detected snapshot file version: 2

  Updated 6627 records.

File: boot_snap.0
  Detected snapshot file version: 2

  Updated 3 records.

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

This document was generated by Sergey Poznyakoff on October, 20 2013 using texi2html 1.78.