Wednesday, June 29, 2005

Ufsdump Tape script

> I need a simple script to dump a server mirrored with solstice disksuite
> tape, then demonstrate how to recover it to a new disk.
> I'm dumping using this:
> ufsdump 0uf /dev/rmt/0hn /
> ufsdump 0uf /dev/rmt/0hn /var
> ufsdump 0uf /dev/rmt/0hn /opt
> ufsdump 0uf /dev/rmt/0h /usr
> The tape successfully rewinds at the end.
> Then I tried this script to see what's on the tape:
> ufsrestore tvf /dev/rmt/0hn > /root.txt
> ufsrestore tvsf /dev/rmt/0hn 2 > /var.txt
> ufsrestore tvsf /dev/rmt/0hn 3 > /opt.txt
> ufsrestore tvsf /dev/rmt/0h 4 > /usr.txt
> The script crashed saying:
> # ./
> ioctl MTFSF: I/O error
> Mount volume 2
> then enter volume name (default: /dev/rmt/0hn) ^Cufsrestore interrupted,
> continue? [yn] n
> The root.txt file contains the contents of /var
> so obviously something's wrong.
> I've tried fiddling with mt commands to no effect. I've also tried
> off the "s" parameter and just trusting the order on the tape.
> What am I doing wrong?

What I'm doing wrong is making things too complicated and using ufsrestore

> ufsrestore tvsf /dev/rmt/0h 4 > /usr.txt

Should read:

ufsrestore tvfs /dev/rmt/0h 4 > /usr.txt

...but that's still too complicated. I broke it into two scripts.

$ more
echo "rewinding tape"
mt -f /dev/rmt/0 rewind
echo "backing up root"
ufsdump 0uf /dev/rmt/0hn /
echo "backing up var"
ufsdump 0uf /dev/rmt/0hn /var
echo "backing up opt"
ufsdump 0uf /dev/rmt/0hn /opt
echo "backing up usr"
ufsdump 0uf /dev/rmt/0hn /usr
echo "rewinding tape"
mt -f /dev/rmt/0 rewind

$ more
echo "moving tape to beginning"
mt -f /dev/rmt/0 rewind
echo "testing restoring root"
ufsrestore tvf /dev/rmt/0hn > /root.txt
echo "testing restoring var"
ufsrestore tvf /dev/rmt/0hn > /var.txt
echo "testing restoring opt"
ufsrestore tvf /dev/rmt/0hn > /opt.txt
echo "testing restoring usr
ufsrestore tvf /dev/rmt/0hn > /usr.txt
echo "rewinding"
mt -f /dev/rmt/0 rewind

Later on I can get fancy using "mt" with "afs" to position the tape.

Thanks to:

Darren Dunham, Alexandre Wanderley, Rich Kulawiec, Peter Stokes, Ric
Anderson, Kevin Gallagher, John Benjamins, Ray Brownrigg (I think I got


Post a Comment

<< Home