Hi,
Tape drives with a very large capacity are very expensive so I thought
I'd
use external USB drives instead.
While modifying the backup script, I thought I'd try using the drive as
a
tape device instead of going to the trouble of creating a file system.
# dump -f /dev/sd0c /etc
works fine and so does:
# restore -f /dev/sd0c
I've got a couple of questions about this that I hope you
can help me with..
Firstly, is this a safe thing to do?
As the disks aren't "mounted" you can remove the disk without
unmounting it (obviously), so could there be a cache somewhere
that might not be flushed properly (for instance).
Secondly, I'm using more than one disk (for different backup sets)
so I need to identify which disk is plugged into which USB port in
the script (the cables will be labelled).
The best I can come up with is:
----
#!/bin/sh
usb_port=/dev/usb0
umass=`usbdevs -f $usb_port -d | grep umass`
if [ ! -z "$umass" ]; then
echo "umass is $umass"
sbus=`dmesg | egrep "scsibus.* at umass0" | tail -1 | awk '{print
$1}'`
if [ ! -z "$sbus" ]; then
echo "sbus is $sbus"
disk=`dmesg | grep $sbus | tail -1 | awk '{print $1}'`
if [ ! -z "$disk" ]; then
echo "disk: $disk"
fi
fi
else
echo "No disk found"
fi
----
I think this should work (given the kernel dmesg buffer is not busy)
but it seems messy. Is there a cleaner way to find out the device
name allocated to a USB disk given a usb port device?
ciao
dave