Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: IDE Tape backup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Mon Dec 12, 2005 7:24 pm    Post subject: HOWTO: IDE Tape backup Reply with quote

HOWTO: IDE Tape backup

Backing up to a tape drive is not unusual in server environments. Most of the time desktop users would just backup to some sort of optical media, but the thought of sitting at my computer and using 5 DVDs to backup just makes me not want to do it. ;) At least with tape backups it can be a cronjob and therefore can be an unattended backup, which can be convenient.

Known Issues / Notes

This guide should work with most IDE tape drives out there. This guide will attempt to set up ide-tape, and should this fail, ide-scsi emulation (which should work in all cases.)

The ide-tape driver does not give as much details about the tape device as the ide-scsi emulation does.

Configuring the kernel

Well, the easiest way is to compile what is needed all at once. We'll install ide-tape and the ide-scsi emulation, just in case we need to switch to it (2.6.x tree shown):

Code:

Device Drivers  --->
     ATA/ATAPI/MFM/RLL support  --->
          <*>     Include IDE/ATAPI TAPE support (EXPERIMENTAL)
          <*>     SCSI emulation support
     SCSI device support  --->
          [*]   legacy /proc/scsi/ support
          <*>   SCSI tape support
          <*>   SCSI generic support


Recompile the kernel and install the new image.

Using ide-tape

First, identify your tape drive:

Code:

computer ~ # dmesg | grep ^hd[a-h]:
...
hdd: Seagate STT20000A, ATAPI TAPE drive
...


Now we need to edit the bootloader and add the tape device (grub example shown):

Code:

kernel /kernel-2.6.12-gentoo-r6 root=/dev/hda3 hdd=ide-tape


Note the hdd=ide-tape. You may need to change it to your tape drive.

Save and restart your computer. After the computer is restarted, check to see if the device nodes have been created (in my case, they were not created at first.)

Code:

computer ~ # ls /dev/ht0
/dev/ht0
computer ~ # ls /dev/nht0
/dev/nht0


If they do not exist, create them (and the tape group if necessary):

Code:

groupadd tape
mknod /dev/ht0  c 37 0
mknod /dev/nht0 c 37 128
chgrp tape /dev/ht0
chgrp tape /dev/nht0
chmod 660 /dev/ht0
chmod 660 /dev/nht0


Continue at Installing required software.

Using ide-scsi emulation

First, identify your tape drive:

Code:

computer ~ # dmesg | grep ^hd[a-h]:
...
hdd: Seagate STT20000A, ATAPI TAPE drive
...


Now we need to edit the bootloader and add the tape device (grub example shown):

Code:

kernel /kernel-2.6.12-gentoo-r6 root=/dev/hda3 hdd=ide-scsi


Note the hdd=ide-scsi. You may need to change it to your tape drive. Check to make sure the device nodes are created:

Code:

computer ~ # ls /dev/st0
/dev/st0
computer ~ # ls /dev/nst0
/dev/nst0


Save and restart your computer.

Continue at Installing required software.

Installing required software

The tools needed are mt-st:

Code:

computer ~ # emerge mt-st


This package includes tools that you can use to operate the tape drive. (See the section below.)

How do I use the tape drive anyway?

The different device nodes

For me, this took a bit of googling and browsing manpages to figure out how to actually use the tape. First, there are two different devices created:

/dev/ht0 (ide) /dev/st0 (scsi)

These two will perform an operation on the tape device and rewind it when the device is closed.

/dev/nht0 (ide) /dev/nst0 (scsi)

These two will perform an operation on the tape device and will not rewind it when the device is closed. You could probably use this to do incremental backups.

Performing operations on the drive

Checking the drive's status

Note: the ide-tape driver doesn't provide a whole lot of useful information here.

Code:

computer ~ # mt -f /dev/ht0 status


Ejecting the cartridge (if applicable)

Code:

computer ~ # mt -f /dev/ht0 rewoffl


Rewinding the tape

Code:

computer ~ # mt -f /dev/ht0 rewind


Retension the tape

Code:

computer ~ # mt -f /dev/ht0 retension


Erasing the tape

Code:

computer ~ # mt -f /dev/ht0 erase


Backing up / restoring files

You can use tar to backup and restore files.

Backup some files

As an example, to back up /home and /exports:

Code:

tar cvf /dev/ht0 /home /exports


Restore some files

First, switch to the directory you want to restore the files into.

Code:

cd ~
tar xvf /dev/ht0


Restoring a single file

You can restore a single file from a tape; however, you need to know its exact filename. This also can take a while to do, as it will have to seek through the tape to locate the file you need.

Code:

tar xvf /dev/ht0 path/to/my/file


What's on the tape? (getting a directory of the tape)

You can use tar to give you a listing of the files on the tape. If you have a lot of files, you may want to redirect the output to a file so you can browse through it's listing:

Code:

tar tvf /dev/ht0


That covers the basic usage of your tape device.

Troubleshooting

I can't find my tape device!

If you are using ide-tape, the devices should be /dev/ht0 and /dev/nht0. If these devices aren't created, try using:

Code:

mknod /dev/ht0  c 37 0
mknod /dev/nht0 c 37 128
chgrp tape /dev/ht0
chgrp tape /dev/nht0
chmod 660 /dev/ht0
chmod 660 /dev/nht0


If you are using ide-scsi, the devices should be /dev/st0 and /dev/nst0.

Conclusion

I do recommend that you at least verify that the device is backing up correctly! Backup a directory and extract a few files to a new directory and compare the two.

Hopefully someone finds the guide useful.


Last edited by danomac on Tue Dec 13, 2005 5:17 pm; edited 2 times in total
Back to top
View user's profile Send private message
bjd
Tux's lil' helper
Tux's lil' helper


Joined: 10 Aug 2005
Posts: 127
Location: Loughborough, UK

PostPosted: Tue Dec 13, 2005 8:10 am    Post subject: Reply with quote

Yes that is useful, been looking at getting a 2nd hand tape for backups for a while. I guess using a SCSI tape would be the same as the IDE-SCSI in the guide? The imagine the userland commands would be the same no matter what the interface.
Back to top
View user's profile Send private message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Tue Dec 13, 2005 5:15 pm    Post subject: Reply with quote

The userland part of the guide will work with both ide and scsi tape drives, but you will have to switch /dev/ht0 for /dev/st0. If it's a true SCSI drive though you will also have to configure the kernel to support the controller as well as compiling the scsi-tape support in.
Back to top
View user's profile Send private message
dapsaille
Advocate
Advocate


Joined: 02 Aug 2004
Posts: 2366
Location: Paris

PostPosted: Thu Dec 29, 2005 10:29 pm    Post subject: Reply with quote

Thanks Danomac :p


This was the year 2005 tip :p

EDIT= Well .. humm is this normal that i can retense my tape .. but i cannot write to it or red it ? ?( i use a 4/8gb tape with a colorado 10/20 and i don't know where the tape come from , does 10/20 reader can write on 4/8 tapes ?? )
Back to top
View user's profile Send private message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Tue Jan 03, 2006 6:44 am    Post subject: Reply with quote

dapsaille wrote:

EDIT= Well .. humm is this normal that i can retense my tape .. but i cannot write to it or red it ? ?( i use a 4/8gb tape with a colorado 10/20 and i don't know where the tape come from , does 10/20 reader can write on 4/8 tapes ?? )


That's a good question. I have a 10/20 and bought the appropriate cartridges for it... maybe the 4/8 has a density the tape drive can't read?
Back to top
View user's profile Send private message
Slurp53
Apprentice
Apprentice


Joined: 14 Jun 2002
Posts: 255
Location: Iowa

PostPosted: Wed Jan 11, 2006 8:43 pm    Post subject: Reply with quote

This worked with my HP Colorado 4/8 gig IDE tape drive. The ide-tape module would not work. I had to use the scsi emulation to get it to work as suggested by jasonlee9 in this post https://forums.gentoo.org/viewtopic-t-53676-highlight-dev+ht0.html Thanks for the Howto...

:D :D
_________________
"Welcome to the Pleasuredome" -- Frankie Goes to Hollywood
Back to top
View user's profile Send private message
Imp.Avgvstvs
n00b
n00b


Joined: 18 Jan 2006
Posts: 20
Location: Turin, Italy

PostPosted: Wed Jan 25, 2006 11:53 am    Post subject: Reply with quote

Anyone have experience with Sony AIT atapi tape ?
Back to top
View user's profile Send private message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Sat Jan 28, 2006 9:50 pm    Post subject: Reply with quote

The only tape drives I've used are the Seagate drives.
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1171

PostPosted: Thu Apr 13, 2006 10:58 pm    Post subject: Reply with quote

Is there any way to see how much space is used/free on particular tape?
_________________
gentoo user
Back to top
View user's profile Send private message
danomac
l33t
l33t


Joined: 06 Nov 2004
Posts: 873
Location: Vancouver, BC

PostPosted: Tue Apr 18, 2006 6:25 pm    Post subject: Reply with quote

tnt wrote:
Is there any way to see how much space is used/free on particular tape?


I don't think there is a direct way to do this. What you can try doing is listing the tape using tar (use the non-rewind device file), then use mt to get your current block. You should be able to figure out how many blocks there are with the status command, then you could do an approximation.

I can't test this for myself as the server is 40km away, and I don't know if there is a tape loaded right now (otherwise I'd use ssh.)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum