Stefan,
The -b argument of amrestore is not working in 3.2.1
The attached patch was commited a long time ago to fix it.
Jean-Louis
On 12/03/2012 10:01 AM, Stefan Gustafsson wrote:
Hi,
We have an running amanda environment (Amanda-3.2.1) based on Ubuntu
11.10 backing up
some XEN hosts.
Last week we did a full disaster recovery test and run into some
problems using the
amrestore tool.
In our config we have:
define tapetype LTO-3 {
comment "Created by amtapetype; compression enabled"
length 413997056 kbytes
filemark 0 kbytes
speed 51186 kps
blocksize 1024 kbytes
}
I we run "amrestore /dev/nst0 host /" it exits with
"ERROR: /bin/gzip exited with status 1"
If we try "amrestore --cconfig conf /dev/nst0 host /" it works
but it depends on the amanda.conf file being present and it's not
since it's a bare metal restore.
Our workaround is to do "amrestore -r /dev/nst0 host /" to read the RAW
files of the tape and then "dd if=host._.XXXX bs=1024k skip=1 | gzip
-dc | tar xv" to
extract the files. It works for us but it's not ideal.
amrestore is documented to have a -b <blocksize> option but it does
not work.
We tried "amrestore -b 1024k /dev/nst0 host /" but the perl code
expects an integer and
aborts with a usage.
"amrestore -b 1048576 /dev/nst0 host /" dies with
"ERROR: /bin/gzip exited with status 1" indicating the $opt_blocksize
is not working.
Is it possible to get amrestore to automatically detect the
block-size? Skipping all zero blocks
after the amanda header until start of data?
Best Regards,
Stefan Gustafsson
Expisoft AB, Sweden
diff --git a/server-src/amrestore.pl b/server-src/amrestore.pl
index 362ee65..41ea901 100644
--- a/server-src/amrestore.pl
+++ b/server-src/amrestore.pl
@@ -173,6 +173,16 @@ sub main {
return failure($err, $finished_cb) if $err;
$dev = $res->{'device'};
+
+ if ($opt_blocksize) {
+ if ( !$dev->property_set("BLOCK_SIZE", $opt_blocksize)) {
+ return failure($dev->error_or_status, $finished_cb);
+ }
+
+ # re-read the label with the correct blocksize
+ $dev->read_label();
+ }
+
if ($dev->status != $DEVICE_STATUS_SUCCESS) {
return failure($dev->error_or_status, $finished_cb);
}