Article -- Using tape drives in Linux
tar and Tape Drives
In this article I will give a basic overview of the tar command relating to accessing tape drives. It will be assumed that your tape drive is located at /dev/st0.
View the contents of the source tape.
tar -tvf /dev/st0
If the contents are compressed you may need to use the j or z switch to read the tape. For gzip compression use z and for bzip2 use j.
tar -ztvf /dev/st0
Copy the contents of the source tape to a directory on the hard drive.
tar -xvf /dev/st0 /dev/hda1 (substitute /dev/hda1 with any destination)
Insert a destination tape.
This command is only useful on some tape drive that support ejection of tapes. The t switch tells the eject command to inject the tape.
eject -t /dev/st0
Format the destination tape as needed.
Simply write zeros to the drive.
dd if=/dev/zero of=/dev/st0
Copy the contents from the directory on the hard drive to the destination tape.
tar -cvf /dev/st0 /
If you want you can also use compression with the j or z switches.
tar -jxvf /dev/st0 /
»
- Login to post comments
