LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-28-2014, 06:40 AM   #1
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Rep: Reputation: Disabled
Problems restoring from tape backup...


Hi all,

I've been googling all morning trying to work this out to no avail, so hoping someone more knowledgeable can help! I've inherited a server that's backing up to a tape drive (/dev/nst0) using tar, and I need to restore from tape. What i've done so far;

1. Rewound the tape (mt -f /dev/nst0 rewind)

2. Tried to list the contents of the tape (tar -b 128 -tzf /dev/nst0) which gives the error:

Code:
gzip: stdin: not in gzip format
tar: Child died with signal 13
tar: Error exit delayed from previous errors
3. I took the 'z' out of the last command (tar -b 128 -tf /dev/nst0) and got the following;

Code:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
This would be the first time trying to restore from tape, and as far as I know the previous admin didn't test the backups so there's every chance it's never worked I suppose, but it may also be that i'm just doing something stupid. Help/ideas would be much appreciated
 
Old 07-28-2014, 09:51 AM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
The error messages say that the tape is not in either tar format or gzip format. The other possibility is bzip2 format. Try using the -tjf parameter to see if the tape is in bzip2 format.

----------------------
Steve Stites
 
Old 07-28-2014, 10:23 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
What's the extension on the file? If it is just .tar, then it may not be compressed at all. Granted someone can place any extension on a file and that doesn't necessarily make it true.

If it is merely a .tar file, then you can view it because it will then be a concatentation of the backed up files, with some added header and delimiter information. Tar means something like "Tape ARchive", if you make an unzipped tar of just two small text files you can look at the resulting .tar file and pretty much see the contents of your two text files. Same thing in this case if it's not a zipped archive, you should be able to see the files, just that it's likely a lengthy file it the backup was performed properly.

Another thing to check is how large is this file? Corresponding large WRT the files it is supposedly being a back up.
 
Old 07-28-2014, 10:27 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by jailbait View Post
...
Sorry for ponying atop of the post, I never noted this before: "Location: Blue Ridge Mountain"

Have a relative from West VA. Beautiful country! I can see why John Denver sang about it.
 
Old 07-28-2014, 10:45 AM   #5
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Update - The following command works (lists contents of tape):

Code:
tar -t --blocking-factor=128 -f /dev/nst0
So do I need to specify --blocking-factor=128 when trying to restore?
 
Old 07-28-2014, 11:55 AM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Did you specify a blocking factor when you archived to tape?

What is the command that you are using to backup to tape?

"Usually" the commands to list/restore are:

Code:
tar -tvf /dev/st0 #(list contents)
tar -xvf /dev/st0 filename #(restore filename/dir from tape)

Last edited by szboardstretcher; 07-28-2014 at 11:59 AM.
 
Old 07-28-2014, 11:57 AM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by batcountry View Post
Update - The following command works (lists contents of tape):

Code:
tar -t --blocking-factor=128 -f /dev/nst0
So do I need to specify --blocking-factor=128 when trying to restore?
Yes, the only real difference between -t and -x is that -t lists where -x extracts.

The -b or --blocking-factor determines the block size used; which is probably meaningful to tape drives versus the rest of the world using tar.

Another thing that's occurring to me is that you never needed to have tried the -z parameter, when you list or extract the filename extension itself should determine for tar what form of unzipping (if any) is required.
 
Old 07-29-2014, 04:20 AM   #8
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Did you specify a blocking factor when you archived to tape?

What is the command that you are using to backup to tape?

"Usually" the commands to list/restore are:

Code:
tar -tvf /dev/st0 #(list contents)
tar -xvf /dev/st0 filename #(restore filename/dir from tape)
Command to backup to tape:

Code:
tar --create --blocking-factor=128 --totals --file=$dlt  config.tar.gz
 
Old 07-29-2014, 06:20 AM   #9
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Yes, the only real difference between -t and -x is that -t lists where -x extracts.

The -b or --blocking-factor determines the block size used; which is probably meaningful to tape drives versus the rest of the world using tar.

Another thing that's occurring to me is that you never needed to have tried the -z parameter, when you list or extract the filename extension itself should determine for tar what form of unzipping (if any) is required.
That makes sense, but i'm having difficulty with the restore. I'm running the following command in /Ext_1Tb and want to restore the complete 2011 dir as a test, but it doesn't work;

Code:
tar --blocking-factor=128 -xvf /dev/nst0 ./Ext_1Tb/2011
And the error:
Code:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
 
Old 07-29-2014, 07:45 AM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by batcountry View Post
That makes sense, but i'm having difficulty with the restore. I'm running the following command in /Ext_1Tb and want to restore the complete 2011 dir as a test, but it doesn't work;

Code:
tar --blocking-factor=128 -xvf /dev/nst0 ./Ext_1Tb/2011
And the error:
Code:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
I don't know what /dev/nst0 and ./Ext_1Tb/2011 represent; /dev/nst0 appears possibly to be the tape drive device. As far as I'm concerned, you don't need all that. My basic form for extracting from a tar file would be the following example, noting also that the easiest things to do are (1) If you don't know the contents or structure of an archive, use tar -tvf <tarfilename> to get a report on it, and (2) when you extract it, do so from the direction location where you wish to extract.

Example:

Code:
# Large tar file that starts at a high level directory, has a lot of files, and many sub-directories

$ cd $HOME
$ tar -tvf /media/tape-drive-mount-location/something.tar
./top-level/.
./top-level/sub-directory/.
./top-level/sub-directory/README
...
# And so forth
# What I learned here is that when this archive gets extracted in the normal manner, it will
# create "top-level" and the associated sub-directories starting at the point where I am
# located in my own directory structure.  Note that you don't have to be in the location of
# the tar file, you can refer to it from a mounted storage location and extract it into a
# different directory, you can specify a target directory to place the results, but it's
# also easy just to be located in the target directory and run the command

$ tar -xvf /media/tape-drive-mount-location/something.tar

# Files get extracted into $HOME where you happen to be at the time
Note also that if the tar file is zipped and has a .gz, or .bz2 extension, tar will be capable of detecting this and perform the unzip operations as part of the extraction.

Once again, the easiest thing to do is the following:

- Go to the location where you wish to put the extracted files.
- Run "tar -xvf <tarfilename>
 
Old 07-29-2014, 08:10 AM   #11
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
I don't know what /dev/nst0 and ./Ext_1Tb/2011 represent; /dev/nst0 appears possibly to be the tape drive device. As far as I'm concerned, you don't need all that. My basic form for extracting from a tar file would be the following example, noting also that the easiest things to do are (1) If you don't know the contents or structure of an archive, use tar -tvf <tarfilename> to get a report on it, and (2) when you extract it, do so from the direction location where you wish to extract.

Example:

Code:
# Large tar file that starts at a high level directory, has a lot of files, and many sub-directories

$ cd $HOME
$ tar -tvf /media/tape-drive-mount-location/something.tar
./top-level/.
./top-level/sub-directory/.
./top-level/sub-directory/README
...
# And so forth
# What I learned here is that when this archive gets extracted in the normal manner, it will
# create "top-level" and the associated sub-directories starting at the point where I am
# located in my own directory structure.  Note that you don't have to be in the location of
# the tar file, you can refer to it from a mounted storage location and extract it into a
# different directory, you can specify a target directory to place the results, but it's
# also easy just to be located in the target directory and run the command

$ tar -xvf /media/tape-drive-mount-location/something.tar

# Files get extracted into $HOME where you happen to be at the time
Note also that if the tar file is zipped and has a .gz, or .bz2 extension, tar will be capable of detecting this and perform the unzip operations as part of the extraction.

Once again, the easiest thing to do is the following:

- Go to the location where you wish to put the extracted files.
- Run "tar -xvf <tarfilename>
Thanks for your reply, appreciated although i'm not getting anywhere.

/dev/nst0 is the tape drive (sym link to /dev/tape also)
/Ext_1Tb is where I want to restore the data to

I have no idea what the structure of the archive on tape looks like, or what it's called. I can't 'cd' to /dev/nst0 (but I guess that's normal?).
 
Old 07-29-2014, 08:20 AM   #12
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by rtmistler View Post
I don't know what /dev/nst0 and ./Ext_1Tb/2011 represent; /dev/nst0 appears possibly to be the tape drive device. As far as I'm concerned, you don't need all that.
He is trying to restore from tape, so yes, he does need all of that.

First off, if this is your BACKUP to TAPE command:

Code:
tar --create --blocking-factor=128 --totals --file=$dlt  config.tar.gz
Then you have only backed up the file config.tar.gz

What do you get if you cd to your destination directory and run:

Code:
tar --blocking-factor=128 -xvf /dev/nst0 config.tar.gz
Without specifying the destination...

Last edited by szboardstretcher; 07-29-2014 at 08:24 AM.
 
Old 07-29-2014, 08:22 AM   #13
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by batcountry View Post
Thanks for your reply, appreciated although i'm not getting anywhere.

/dev/nst0 is the tape drive (sym link to /dev/tape also)
/Ext_1Tb is where I want to restore the data to

I have no idea what the structure of the archive on tape looks like, or what it's called. I can't 'cd' to /dev/nst0 (but I guess that's normal?).
When you perform an ls on /dev/nst0 you should see the tar file name.

Change directory to /Ext_1Tb and extract using the full path and name of the tar file, full path is /dev/nst0, name of the tar file is the name of the tar file which you see when you perform a directory listing of /dev/nst0.

Code:
$ cd /Ext_1Tb
$ tar -xvf /dev/nst0/<tar-file-name>
Perhaps you're saying that /dev/nst0 is a symbolic link, then perform a long listing of /dev/nst0 to determine where the link is pointing too.

Code:
$ ls -l /dev/nst0
But it sounds as if /dev/nst0 is merely a symbolic link to /dev/tape.

What you're missing is that you need to refer to the actual .tar file, you can't just give the "directory" name where the file exists, you need to give the tar file name.
 
Old 07-29-2014, 08:25 AM   #14
batcountry
LQ Newbie
 
Registered: Jul 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Code:
[root@batcountry /]# ls -l /dev/nst0
crw-rw----  1 root disk 9, 128 Jul 18 10:09 /dev/nst0
Code:
[root@batcountry /]# ls -l /dev/tape
lrwxrwxrwx  1 root root 4 Jul 18 10:09 /dev/tape -> nst0
 
Old 07-29-2014, 08:37 AM   #15
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Here is a test I JUST ran successfully on my tape array:

Code:
# Load a tape and rewind
mtx -f /dev/changer status
mtx -f /dev/changer load 0 1
mt -f /dev/st0 rewind

# Tar and compress a text file to the tape
tar -czvf /dev/st0 /root/testing1.txt

# Look at the contents of the tape
tar tvf /dev/st0

# Restore the file from the tape
mkdir /tmp/restore && cd /tmp/restore
tar -xzvf /dev/st0 root/testing1.txt
What I am concerned about is that you cannot list the contents of the tape. Once we have that part nailed down, restoration is simple. If listing has worked, please provide the list contents.

Last edited by szboardstretcher; 07-29-2014 at 08:46 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems restoring system from backup using rsync rootaccess Linux - General 18 11-25-2012 03:23 AM
Restoring tape contents g_ramesh Linux - Newbie 4 10-18-2010 06:29 AM
[SOLVED] Failure restoring a cpio backup from tape dguy Linux - Server 10 03-29-2009 09:12 AM
Using a DDS5 tape drive to restore from a DDS3 backup tape. AndrewCAtWayofthebit Linux - Hardware 1 05-14-2006 09:15 AM
Help restoring from tape and tar...... TheDirtyPenguin Linux - Software 1 02-17-2004 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration