Restore from tape (not using Amanda) syntax
Title: Restore from tape (not using Amanda) syntax Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: #mt -f /dev/rmt/0n status Vendor 'SONY ' Product 'SDX-300C ' tape drive: sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0 #mt -f /dev/rmt/0n rewind I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? Thanks, Gordon.
Re: Restore from tape (not using Amanda) syntax
--On Wednesday, September 25, 2002 21:38:55 +1000 Gordon Cormack [EMAIL PROTECTED] wrote: Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The 'c' option to tar means 'create'. You need to extract so use 'x' instead. Frank The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? Thanks, Gordon. -- Frank Smith[EMAIL PROTECTED] Systems Administrator Voice: 512-374-4673 Hoover's Online Fax: 512-374-4501
Re: Restore from tape (not using Amanda) syntax
--On Wednesday, September 25, 2002 08:42:07 -0500 Frank Smith [EMAIL PROTECTED] wrote: --On Wednesday, September 25, 2002 21:38:55 +1000 Gordon Cormack [EMAIL PROTECTED] wrote: Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: I'm obviously doing something wrong here cause the command: # dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The 'c' option to tar means 'create'. You need to extract so use 'x' instead. I hate to reply to myself, but I didn't notice you were also giving tar a filename. If you just want the tar file that was on the tape, forget the pipe and use of=/export/output.tar. If you are trying to extract the tar that is on the tape, leave off the filename and tar will extract from stdin. Frank The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? Thanks, Gordon. -- Frank Smith[EMAIL PROTECTED] Systems Administrator Voice: 512-374-4673 Hoover's Online Fax: 512-374-4501 -- Frank Smith[EMAIL PROTECTED] Systems Administrator Voice: 512-374-4673 Hoover's Online Fax: 512-374-4501
Re: Restore from tape (not using Amanda) syntax
On Wed, Sep 25, 2002 at 09:38:55PM +1000, Gordon Cormack wrote: I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: #mt -f /dev/rmt/0n status Vendor 'SONY' Product 'SDX-300C ' tape drive: sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0 #mt -f /dev/rmt/0n rewind I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive You're mixing your metaphors, I'm afraid. Either of the following should work 1) dd if=/dev/rmt/0n bs=32k skip=1 of=/export/output.tar This will create the tar file for you (hopefully you haven't compressed the tar file on tape - if you have, change to of=/export/output.tar.gz) and then you can use tar [tx]f (or [tx]zf if compressed) to list|extract the contents. 2) dd if=/dev/rmt/0n bs=32k skip=1 | tar xf - This will extract the tar file under the current directory for you. Use tar xzf if it was compressed, or tar tf (or tzf if compressed) if you just want to view the contents of the backup file. The command line you gave was a bit of a mix of both of the above and it was simply wrong. Kindest regards, Niall O Broin
Re: Restore from tape (not using Amanda) syntax
On Wed, Sep 25, 2002 at 09:38:55PM +1000, Gordon Cormack wrote: Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: #mt -f /dev/rmt/0n status Vendor 'SONY' Product 'SDX-300C ' tape drive: sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0 #mt -f /dev/rmt/0n rewind I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? You haven't read/understood the layout of an amanda tape. An amanda tape consists of separate tape files, administrative ones at the start and end of the tape, and individual tape files for the dump of each disk list entry. When you amlabel a tape, the first file is laid down identifying the tape. Guess how amanda knows what tape it is, it reads the first file. When you rewind and take the first data from the tape, you are trying to untar, the amanda label, not a dump. Guess how big that file is, 32KB. Just the size you skipped. Thus tar's input is empty, just as it says. You have to position the tape (using mt) at the beginning of a dump file. Other considerations: - why are you trying to create a tar archive (-c option)? don't you already have a tar archive on the tape that you want to extract? - did you use hardware or software compression? if the latter, you need a gzip -dc in that pipeline. - the first 32KB of each dump file (the header you are trying to skip over) contains a pretty close approximation of the command line you need to extract that dump file. To read the header, position the tape with mt and use your dd command without tar, changing skip to count. -- Jon H. LaBadie [EMAIL PROTECTED] JG Computing 4455 Province Line Road(609) 252-0159 Princeton, NJ 08540-4322 (609) 683-7220 (fax)
Re: Restore from tape (not using Amanda) syntax
Gordon, You've got several things wrong here. First, you didn't use mt to forward the tape to the beginning of a tape file. After your rewind command, try: mt -f tapedev fsf number where number is the location of the tape file that you want to extract. Just for testing, pick 1. Second, your tar syntax isn't quite right. The -c tells tar to create an archive, which is not what you want. You want either -x to extract, or -t to list without extracting (good option to test with). The -f switch tells tar what file to create or read (depending on the previous -c or -x switch). You need to tell it to read from STDIN which is done with a '-', like so: 'tar -tvf -' Also, you don't include a pipe through gzip, which implies that your tape file is uncompressed. If you do compress your data (not hardware compression) then you also need to pipe you command through gzip, like so: dd if=tapedev bs=32k skip=1 | gzip -dc | tar -tvf - Alternatively, you can use the 'z' switch to GNU tar and it will pipe through gzip for you: dd if=tapedev bs=32k skip=1 | tar -tvzf - To make all of this easy, you can read the header at the beginning of each tape file, and it will tell you the command to extract: mt -f tapedev rewind mt -f tapedev fsf 1 dd if=tapedev bs=32k count=1 Be sure to rewind the tape again after you do that. Good luck! Anthony Valentine On Wed, 2002-09-25 at 03:38, Gordon Cormack wrote: Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: #mt -f /dev/rmt/0n status Vendor 'SONY' Product 'SDX-300C ' tape drive: sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0 #mt -f /dev/rmt/0n rewind I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? Thanks, Gordon. -- UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
RE: Restore from tape (not using Amanda) syntax
Title: RE: Restore from tape (not using Amanda) syntax Thanks again guys for your quick and informative responses. The main problem was the lack of coffee at 9:30pm onwards at night but essentially this command is what did it for me: dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -xv -f - Worked like a treat and I am now up-and-running once again! Thanks to all those who responded... Cheers, Gordon. -Original Message- From: Gordon Cormack Sent: Wednesday, 25 September 2002 9:39 PM To: [EMAIL PROTECTED] Subject: Restore from tape (not using Amanda) syntax Hi Peoples, I'm trying to dump from an Amanda tape onto the hard-drive by not using Amanda. This is probably a you don't know how to use tar properly question but: #mt -f /dev/rmt/0n status Vendor 'SONY ' Product 'SDX-300C ' tape drive: sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0 #mt -f /dev/rmt/0n rewind I'm obviously doing something wrong here cause the command: #dd if=/dev/rmt/0n bs=32k skip=1 | /usr/local/bin/tar -cv -f /export/output.tar /usr/local/bin/tar: Cowardly refusing to create an empty archive The tape only has about 2GB of compressed data on it so it's not huge... Any ideas? Thanks, Gordon.