nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

ERRORS: Sun to Linux GNU tar tape restore on a 64 bit box

This is a discussion on ERRORS: Sun to Linux GNU tar tape restore on a 64 bit box within the Linux software forums, part of the Linux Getting Started category; All - We are attempting to restore from a SDLT tape drive off a Sun Server to a SDLT tape ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 06-09-2005, 06:39 AM
Junior Member
 
Join Date: Jun 2005
Location: Kansas City
Posts: 1
Rep Power: 0
tnicks
Default ERRORS: Sun to Linux GNU tar tape restore on a 64 bit box

All -

We are attempting to restore from a SDLT tape drive off a Sun Server to a SDLT tape drive, Linux OS, 585 64 Bit server. We are currently getting the following errors and are at a loss on how to resolve, any thoughts?

[root@daa21267orc302 efiledump]# mt -f /dev/nst0 status

SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x49 (Quantum SDLT320). Soft error count since last status=0 General status bits on (41010000): BOT ONLINE IM_REP_EN

[root@daa21267orc302 efiledump]# tar xvf /dev/nst0
tar: /dev/nst0: Cannot read: Cannot allocate memory
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-09-2005, 03:27 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Use tar command as follows:
mt -f /dev/nst0 rewind
mt -f /dev/nst0 status
mt -f /dev/nst0 tell
tar --blocking-factor=128 -xvf /dev/nst0

--blocking-factor=N
Set N correct, this N is same used on solaris while you run the tar command. Default N=1 on solaris, howerver last time i done this it was value of 500 wored for me you can use mt -f /dev/nst0 status command to find the block size and use that as blocking-factor. This error only occurs if OS changes
Reply With Quote
  #3 (permalink)  
Old 06-09-2005, 03:41 PM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 154
Rep Power: 4
sweta will become famous soon enough
Default

Not sure about this error we use http://www.amanda.org/ Amanda backup software and it works without problem may be software does blocking-factor works.
Reply With Quote
  #4 (permalink)  
Old 06-09-2005, 03:59 PM
Member
User
 
Join Date: Jun 2005
Posts: 78
Rep Power: 0
jerry
Default

A good doc to read @ http://www.ibiblio.org/pub/historic-...si/README.tape


dd and tar - blocking factor. How to determine the blocking factor, block size
so that tar and dd can work together.

Step 1: Create a large file on local disk, in a directory "1" that will eventually
be written to tape. This will be created with dd as follows:

$ mkdir 1
$ dd if=/dev/zero of=disk-image count=40960
40960+0 records in
40960+0 records out

$ cd ..

Step 2: tar the directory and contents to tape. First rewind the tape. These examples
use /dev/nst0 as the location of the tape. Make sure to substitute your values
if needed.

$ mt -f /dev/nst0 rewind
$ tar --label="Test 1" --create --blocking-factor=128 --file=/dev/nst0 1

Step 3: Read data from the tape using a block size of 128k. If you get an I/O error, which
could happend if you used a different blocking factor above, then, you may need
to increase the bs to 256, or 512 etc. as needed.

$ mt -f /dev/nst0 rewind
$ dd if=/dev/nst0 bs=128k of=testblocksz count=1
0+1 records in
0+1 records out

$ ls -l testblocksz
-rw-r--r-- 1 root root 65536 Feb 9 10:41 testblocksz

$ ls -lh testblocksz
-rw-r--r-- 1 root root 64k Feb 9 10:41 testblocksz

Note above that the size 65536 is equal to 64k. That "h" switch in "ls" is for
human readable.


Step 4: tar uses a multiplier of 512*blocking-factor to get block size. Again

512 * blocking-factor = block size used in dd command.

Putting in the values, we see that

512 * 128 = 65536


Step 5: So what does this tell you? You can now use these numbers to "dd" files
to tape. But, first tar will be used to create the file locally.

$ tar --label="Test 1" --create --blocking-factor=128 --file=test.tar 1


Step 6: Send this to tape with the dd command. Remember 64k is equal to 65536.

$ mt -f /dev/nst0 rewind
$ dd if=test.tar bs=64k of=/dev/nst0


Step 7: Now test that it can be read with tar command using blocking-factor=128.
Note the "t" command in tar is for tell. It will not write data.

$ mt -f /dev/nst0 rewind
$ tar -tvf /dev/nst0 --blocking-factor=128
V--------- 0/0 0 2005-02-09 10:38:20 Test 1--Volume Header--
drwxr-xr-x root/root 0 2005-02-09 10:34:10 1/
-rw-r--r-- root/root 20971520 2005-02-09 10:34:11 1/disk-image


Step 8: Reading tape data with dd. Most of the time a high "ibs" input block size

$ mt -f /dev/nst0 rewind
$ dd if=/dev/nst0 of=outfromdd.tar ibs=64k
321+0 records in
41088+0 records out


Step 9: Verify that outfromdd.tar can be read by tar with blocking-factor=128

$ tar -tvf outfromdd.tar --blocking-factor=128
V--------- 0/0 0 2005-02-09 10:38:20 Test 1--Volume Header--
drwxr-xr-x root/root 0 2005-02-09 10:34:10 1/
-rw-r--r-- root/root 20971520 2005-02-09 10:34:11 1/disk-image


PULLING FILES: The dd command can be used to pull files.

ssh target_address dd if=remotefile | dd of=localfile

Or, a specific example of getting a file from a computer called hamlet.

$ ssh root@hamlet dd if=/home/cvs/test | dd of=/home/storage/test


GOING BACKWARD AND FORWARD ON TAPE:

Go to end of data
$ mt -f /dev/nst0 eod

Previous record
$ mt -f /dev/nst0 bsfm 1

Forward record
$ mt -f /dev/nst0 fsf 1

Rewind
$ mt -f /dev/nst0 rewind

Tell
$ mt -f /dev/nst0 tell

(Reference TIP 151 - for how to get around firewall

Below is a script that I use to backup computers via ssh. The
tape drive is on "nis" and the extra space is on "hamlet".

#!/bin/bash
# Program to backup server remotely
# Assume remote server is nis, you are on squeezel
#
# Recover from tape
#
# dd if=/dev/nst0 of=test.tar.gz bs=64k
#
filename="support1.$(date "+%m%d%y%H%M").tar.gz"
DIRTOBACKUP=/var/www
#tar cvzf - $DIRTOBACKUP | ssh root@nis '(mt -f /dev/nst0 rewind; dd of=/dev/nst0 bs=64k )'
tar cvzf - $DIRTOBACKUP | ssh support1@hamlet "dd of=/home/support1/backups/${filename} "

Another example program, below, pushes the last ".tar.gz" file to tape:

#!/bin/bash
# Program to push files to tape
#
#
# Notes on recovering from tape
#
# dd if=/dev/nst0 of=test.tar.gz ibs=64k
# or
# $ ssh root@tapeserver "mt -f /dev/nst0 rewind"
# $ ssh root@tapeserver "dd if=/dev/nst0 ibs=64k"|dd of=cvs1.tar.gz
#
#
#
# First rewind tape
ssh root@tapeserver 'mt -f /dev/nst0 rewind'
#
# Grab only the last file
file=$(find /home/cvs -iname 'cvs*.tar.gz'|sort|tail -n 1)
dd if=${file}|ssh root@tapeserver 'dd of=/dev/nst0 bs=64k'

Source url: http://souptonuts.sourceforge.net/ho...pen_source.htm # 136 hope this helps you.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How to Create auto restore CD/DVD for linux ppnair Linux software 0 02-22-2008 11:42 AM
How to Create auto restore CD/DVD for linux ppnair Mail Servers 0 02-21-2008 03:46 PM
prelink errors... CentOS 5 ITDevil CentOS / RHEL / Fedora 2 11-13-2007 05:59 PM
tar tape command example tom Getting started tutorials 0 06-05-2007 10:36 AM
How Do I restore mbr in Linux? jerry Linux software 2 06-16-2005 03:48 PM


All times are GMT +5.5. The time now is 12:05 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36