[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] update version of tar-snapshot-edit script
From: |
Nathan Stratton Treadway |
Subject: |
Re: [Bug-tar] update version of tar-snapshot-edit script |
Date: |
Mon, 19 Sep 2011 00:47:10 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Wed, Sep 14, 2011 at 18:15:50 -0400, Nathan Stratton Treadway wrote:
> On Sat, Aug 27, 2011 at 14:48:11 -0400, Nathan Stratton Treadway wrote:
> > During a recent discussion on the amanda-users mailing list, we
> > discovered that the tar-snapshot-edit script currently found at
> >
> > http://www.gnu.org/software/tar/utils/tar-snapshot-edit
> >
> > doesn't work with recent versions of Perl. (It works when I try it with
> > Perl 5.8.8, but not with, for example, Perl 5.10.1 from Ubuntu Lucid.)
> [...]
> > still seems like it might prove useful from time to time. So I'm
> > attaching an updated version of the script which appears to work
> > correctly with both versions of Perl (and presumably later ones as
> > well).
>
> Let me know if I can provide any other information about these changes
> to the tar-snapshot-edit script.
I realized that the "info" documentation for the script should also be
updated to reflect the new formatting for the output it generates;
here's a patch that does that.
It also takes a stab at updating and expanding a few other parts of that
page (e.g. to mention the --no-check-device option); feel free to tweak
those changes as you see fit...
Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway - address@hidden - Mid-Atlantic region
Ray Ontko & Co. - Software consulting services - http://www.ontko.com/
GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt ID: 1023D/ECFB6239
Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239
--- tar_orig/doc/tar-snapshot-edit.texi 2011-09-17 18:12:04.039667522 -0400
+++ tar/doc/tar-snapshot-edit.texi 2011-09-19 00:38:19.439667098 -0400
@@ -6,24 +6,28 @@
@cindex Device numbers, changing
@cindex snapshot files, editing
@cindex snapshot files, fixing device numbers
- Sometimes device numbers can change after upgrading your kernel
-version or reconfiguring the hardware. Reportedly this is the case with
-some newer @i{Linux} kernels, when using @acronym{LVM}. In majority of
+ 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 @acronym{LVM} or @acronym{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
@command{tar} incremental backups: the device number is stored in tar
snapshot files (@pxref{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.
+change for some reason, by default the next backup you run will be a
+full backup.
+
@pindex tar-snapshot-edit
To minimize the impact in these cases, GNU @command{tar} comes with
the @command{tar-snapshot-edit} utility for inspecting and updating
-device numbers in snapshot files. The utility, written by
-Dustin J.@: Mitchell, is available from
+device numbers in snapshot files. (The utility, written by
+Dustin J.@: Mitchell, is also available from the
@uref{http://www.gnu.org/@/software/@/tar/@/utils/@/tar-snapshot-edit.html,
address@hidden home page}.
address@hidden home page}.)
- To obtain the device numbers used in the snapshot file, run
+ To obtain a summary of the device numbers found in the snapshot file, run
@smallexample
$ @kbd{tar-snapshot-edit @var{snapfile}}
@@ -31,10 +35,19 @@
@noindent
where @var{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
address@hidden option. It takes a single argument of the form
+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 @command{ls -l} or @command{stat}).
+
+ Assuming the device numbers have indeed changed, it's often possible
+to simply tell @GNUTAR{} to ignore the device number when processing the
+incremental snapshot files for these backups, using the
address@hidden option (@pxref{device numbers}).
+
+ Alternatively, you can use the @command{tar-edit-snapshot} script's
address@hidden option to update all occurrences of the given device
+number in the snapshot file(s). It takes a single argument
+of the form
@address@hidden@var{newdev}}, where @var{olddev} is the device number
used in the snapshot file, and @var{newdev} is the corresponding new device
number. Both numbers may be specified in hex (e.g., @samp{0xfe01}),
@@ -49,9 +62,30 @@
An example session:
@smallexample
-$ @kbd{tar-snapshot-edit /var/backup/snap.a}
-file version 2
-/tmp/snap: Device 0x0306 occurs 634 times.
-$ @kbd{tar-snapshot-edit -b -r 0x0306-0x4500 /var/backup/snap.a}
-file version 2
+$ @kbd{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.
+$ @kbd{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.
@end smallexample