digital adj. Having digits.     peer n. A comrade; a companion; a fellow; an associate. a.k.a. GEEKED    
   
Recent Articles
Mount JFFS2 Image
Saturday, October 25, 2008
Ottawa Linux Symposium 2008
Sunday, July 27, 2008
Here are some pictures from the 2008 Linux Symposium.
Linux Symposium 2008
Sunday, July 20, 2008
I'll be attending the Linux Symposium this year.
Clay Shirky: Institutions vs. collaboration
Monday, July 14, 2008
This is a rather interesting talk that takes some very foundational ideas from open source software development, P2P networks, and social networking and implies that these paradigms can apply to a lot more.
Fremont Street
Sunday, July 29, 2007
Remote Control Dragonfly
Sunday, July 29, 2007
Videos
Sunday, July 29, 2007
Assortment of videos.
Honda CBR F4 Carburetor Cleaning
Monday, July 23, 2007
Details on how to clean F4 carburetors.

Programmer n. - An ingenious device that turns caffeine into code.

Sys Admin-Linux...-Colorado 5GB...

Colorado 5GB IDE Tape Drive in Linux

Thursday, July 8, 2004 by digitalpeer, updated Saturday, August 7, 2004

The first thing to note is there are two devices created if your tape drive is detected. There is a /dev/ht0 and a /dev/nht0. The first one, when used, will rewind the tape to the beginning after every command to it. The later, will leave the tape at its current position. If you want to work with non rewinding tape drives, to store multiple files and be able to get to each of them, then this probably won't help you much.

I am strictly interested in backup up a single filesystem to a tape, and overwriting anything that was on there. I prefer software compression (gzip in this case), so I don't really deal with the hardware density and compression settings, but it's pretty easy to do.

Anyhow, here's the current backup script I'm using. If I forget to take a tape out, it will overwrite what's on there, which in reality, isn't that big of a deal to me. This is not my only method for backup, but is mainly just another level of precausion. So stick this somewhere and run it as a cron job sometime when you arn't trying to sleep because this particular tape drive makes a good bit of noise.
#!/bin/sh
#
#  Copyright (C) 2004, J.D. Henderson <www.digitalpeer.com>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#
# This is a simple backup script for my Colorado 5GB internal tape drive.
# Simply uses tar with software gzip compression.
#
# Theory...
# It's just stupid to backup multiple tape files or use anything other than a
# full backup on a tape drive these days so that's all this script does.  The
# drive doesn't eject so if you slap this in crontab (like me) and forget to
# swap the tapes out it will simply overwrite what's on there.
#

if [ $# -lt 1 ]
then
   echo "usage: $0 <directories>"
   exit;
fi


# The device to use.
# I am only interested in the rewinding device
DEVICE=/dev/ht0

# The directories to backup
DIRECTORIES=$1

#
# Make sure i've got a damn tape in the drive.
#
if ( ! mt -f $DEVICE status ) then
	echo "No tape in drive." && exit 1
fi

#
# Actually do the backup now, and time that sucker so I can monitor how
# long it's taking.
#
echo Starting at `date` ...
time tar -c --totals -z -f $DEVICE $DIRECTORIES
echo Ending at `date`

exit 0

Now, here's what you'll need to know if you wanna see what's on a tape:
tar tvfz $DEVICE

And, here's what you'll need to know if you wanna extract it all:
tar xvfz $DEVICE

Is tape drive access failing?


If you have an IDE tape drive, and it's failing, you may need to turn off DMA access. I had to do this otherwise I got an I/O error on any command to the drive. You can disable DMA with the command:
hdparm -d 0 /dev/hdd

You can look at startup to see what drive id your IDE tape drive is detected as.

Submit Comment to This Article - Be the first!
Please post a comment if you have something to add, find something wrong, or would like more information on the topic at hand. Do not use the comment form to contact the author about unrelated concerns!

Name: Email (optional):
Enter verification number here: