Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of the DD programme to duplicate tape media 2

Status
Not open for further replies.

bazil2

Technical User
Feb 15, 2010
148
DE
Does anyone have a good understanding of the programme 'DD'?

I need to duplicate AIT-3 tapes by means of reading (to cache) then writing to another tape.

The problem is that tapes may be of different lengths hence should the source tape be shorter (by a few cm) than that of the destination drive then obviously it won't work.

The workflow should be along the lines of:

READ xGB to hard disk temp cache from source drive, then WRITE xGB to destination drive.

Best regards
 
Have you checked out the dd man page? The options are quite straightforward, just specify the input file (or tape device), output file (or device), block size (choose the one that was used to write the tape originally, if you know what it was) and number of blocks.

Annihilannic.
 
I've looked at the man page and the corresponding info page.

Basically I have two tape drives; the source drive has the following address: /dev/sg1 and the destination tape drive has the address: /dev/sg2

The original data was written to the tape with a maximal block size of 64K.

The tapes hold around 200GB so the goal is to read say 20GB form the destination to cache e.g. /raid/dd_cache

Then to write the 20GB to the destination, empty the cache and start again with the next 20GB.

Are you able to help me put this together?

dd if=/dev/sg1 of=/dev/sg2


Best regards
 
There is a little tool called tcopy that you can download for free if you don't have it. It should do what you want.
 
I believe you should use the /dev/nst* devices rather than trying to use /dev/sgN directly. See man st for info about these devices.

I would try something like this, unfortunately I don't have anything to test it on.

Code:
mt -f /dev/nst0 rewind
mt -f /dev/nst1 rewind
while [[ $? -eq 0 ]]
do

  dd bs=65536 count=327680 if=/dev/nst0 of=/dev/nst1

  # or if you really need to use a hard drive intermediary
  #dd bs=65536 count=327680 if=/dev/nst0 of=/raid/dd_cache &&
  #dd bs=65536 count=327680 if=/raid/dd_cache of=/dev/nst1

done

But... I've never done this, and it's possible as well that it would result in multiple 20GB "files" or markers on the destination tape - definitely test a restore from it afterwards! RhythmAce' solution may be a better option.

Annihilannic.
 
Many thanks Annihilannic and RhythmAce.

I am going to try both the DD and tcopy solution!

Could I please ask for your help on the tcopy installation package; I found it located here:


I'm sorry my questioning is a little elementary but how do I go about installing this package? The gunzip and tar extraction provide four executable files but I'm confused as to where to begin.

Best regards
 
Are you referring to these four files?

Code:
-rwxr-xr-x+ 1 user     mkgroup  345 2000-07-08 03:34 Makefile
-rwxr-xr-x+ 1 user     mkgroup 1921 2000-07-08 03:34 pathnames.h
-rwxr-xr-x+ 1 user     mkgroup 3802 2000-07-08 03:34 tcopy.1
-rwxr-xr-x+ 1 user     mkgroup 7836 2000-07-08 03:34 tcopy.c

If so, they are not executables, but the source code, so you need to compile it first. If you run the make command, it should read the Makefile above to determine how to compile it, and if all goes to plan you should end up with an executable file called tcopy. You can either use it directly from there, or if you prefer, install it to /usr/bin/tcopy by running make install as root in that directory.

Annihilannic.
 
Good afternoon Annihilannic,
Could I ask for your opinion on the following; in your previous DD example, you recommended the 'st' over 'sg'. Have I understood correctly, st creates a numerical entry for each SCSI tape device it finds and have no numerical relation to their 'sg' counterparts?

Am I correct in thinking I was use trial and error to work out which drive is which st number?

Best regards


[root@sgi dev]# ls -al st*
crw-rw---- 1 root disk 9, 0 Aug 27 19:01 st0
crw-rw---- 1 root disk 9, 96 Aug 27 19:01 st0a
crw-rw---- 1 root disk 9, 32 Aug 27 19:01 st0l
crw-rw---- 1 root disk 9, 64 Aug 27 19:01 st0m
crw-rw---- 1 root disk 9, 1 Aug 27 19:01 st1
crw-rw---- 1 root disk 9, 97 Aug 27 19:01 st1a
crw-rw---- 1 root disk 9, 33 Aug 27 19:01 st1l
crw-rw---- 1 root disk 9, 65 Aug 27 19:01 st1m
crw-rw---- 1 root disk 9, 2 Aug 27 19:01 st2
crw-rw---- 1 root disk 9, 98 Aug 27 19:01 st2a
crw-rw---- 1 root disk 9, 34 Aug 27 19:01 st2l
crw-rw---- 1 root disk 9, 66 Aug 27 19:01 st2m
lrwxrwxrwx 1 root root 15 Aug 27 19:01 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Aug 27 19:01 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Aug 27 19:01 stdout -> /proc/self/fd/1
[root@sgi dev]#
 
When linux finds devices such as drives, it assigns them a number. For example, if you have two physical hard drives, the first would be /dev/hda and the second /dev/hdb. Now if there are more than one partition on a device, it would be numbered hda0, hda1, etc. If those were scsi drives rather than ide drives, they may be identified as /dev/sda and so on. In your case, scsi tape drives are identified as /dev/st?. Usually, the primary or default device will will receive the number '0'. The sequence is based on the order they are found. In many cases, the system will also give them another name. For example, if hdb is a cd-rom, the system will create a link so that /dev/hdb and dev/CD-ROM point to the same device. When the system boots, it lists all the devices it finds and what name it gave the device. This and a lot of other information can be found by using the 'dmesg' command. It will tell you what it is calling your tape drives.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top