1. Place a data tape into the tape drive.
2. Write down the order of the partitions which you are going to backup. Use the /etc/fstab of the remote box [the box you are backing up] as a guide. Write this informantion and the date on the tape. You will need this information when you restore the backed up data. Also indecate what type of disk drive you are backing up [scsi or ide].
3. Be sure that there is a .rhosts file in the /root of the remote box. This should have an entrie of:
bak.code-donkey.org root
Be sure that the premissions of the .rhosts is restricted only to root:
chmod 600 /root/.rhosts
You will also need to have an entrie of the remote box in the /root/.rhosts on bak.code-donkey.org:
hostname.code-donkey.org root
4. This is an example of the string used to backup "/dev/hda5" to the tape drive "/dev/nst0" over the network.
rsh xxx.code-donkey.org "/sbin/dump -0ua -f root@bak.code-donkey.org:/dev/nst0 /dev/hda5"
USED ON BAK
1. To be sure that the connectons can be establised you should rsh to the remote box [the box which is being backed up] from the box which hosts the tape drive. Also rsh to the the box which hosts the tape drive from the remote box.
It would also be helpful to have a copy of the orignal /etc/fstab.
An example:
rsh xxxxxx.code-donkey.org "/sbin/dump -0ua -f root@bak.code-donkey.org:/dev/nst0 /dev/hda5"
[the host you bk up] [id][host the tape is on] [tape] [partition]
- The tape drive uses the device /dev/nst0.
- restore -if /dev/nst0
restore uses "tape" as opposed to "/dev/nst0" so you may need to link /dev/nst0 to /dev/tape.
The default tape device is /dev/st0 - I beleave /st0 is rewindable.
- restore -if /dev/nst0
If you do not use -f the restore will use /dev/tape as the dump device.
- restore -i /dev/tape
This commnand allows you to look "interactively" at what is on the tape. You might needed to
rewind the tape first.
First:
ln -s /dev/nst0 tape
then:
mt load
then:
mt status
then:
restore -if /dev/tape
This will show what is on the tape, and put you into a shell, which will allow you to
run certin commands.
Now Trying to Restore the Tape.
From the backup box, bak.code-donkey.org:
rsh tmp1.code-donkey.org "/sbin/restore -i cd /box -h -f root@bak.code-donkey.org:/dev/nst0"
Test:
/sbin/restore -if /dev/st0
it then did:
spcl.c_filesys = /
dirptr = (null)
dirptr = (null)
filesys = /
/sbin/restore >
So I typed "help" and got a list of instructions. I cd into the /home on the tape.
Then I typed:
add httpd
- then useing ls I saw an "*" beside httpd. At this point I typed:
extract
I was then prompted for the volume number [tape], as there is only one tape I typed 1.
If there were more than one tape, I would do the first one, then when asked for the
next tape I would put in the last one, and from then on, I would work BACKWARDS.
For example 6,5,4,3,2, etc..
Specify next volume #: 1
If you are going to do a full restore you donot want to be in "interactive mode"
When the "extract" was done, I answered "yes" to "set owner/mode for '.'? [yn] y"
LATTE
Latte /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/da0s1b none swap sw 0 0
/dev/da0s1a / ufs rw 1 1
/dev/da0s1f /usr ufs rw 2 2
/dev/da0s1e /var ufs rw 2 2
proc /proc procfs rw 0 0
From BAK
rsh latte.code-donkey.org "/sbin/dump -0ua -f root@bak.code-donkey.org:/dev/nst0 /dev/da0s1a"
rsh latte.code-donkey.org "/sbin/dump -0ua -f root@bak.code-donkey.org:/dev/nst0 /dev/da0s1f"
In this ittration I changed the tape device to /dev/st0 which is rewindable.
rsh latte.code-donkey.org "/sbin/dump -0ua -f root@bak.code-donkey.org:/dev/st0 /dev/da0s1e"
Create:
200m / [fs]
400m swap
200m /var [fs]
use the remainder for /usr [fs]
Next you will need to run the new fs command. See below.
To make a new fs and restore with a tape drive which is directly conneted to the router you:
Do this for each partition.
SCSI
newfs /dev/da1s1a [/]
newfs /dev/da1s1b [swap]
newfs /dev/da1s1f [/usr]
newfs /dev/da1s1e [/var]
IDE
newfs /dev/wd1s1a [/]
newfs /dev/wd1s1b [swap]
newfs /dev/wd1s1f [/usr]
newfs /dev/wd1s1e [/var]
Make sure that you "restore" in the same order which you did the "dump" in. So it would be /dev/da1s1a, /dev/da1s1f, /dev/da1s1e. Also notice that thease slices are for a secondery disk. So when the files have been reinstlled they should be for a primary disk "da0" not "da1".
For refernce see the MAN pages on:
dump
restore
mt
- Each host should have a /root/.rhosts file setup for the approprate computers.
eg:
name.domain root
Be sure to do a chmod 600 .rhosts to keep the file readable only by root.
The "mt" commands are done on the computer which is hosting the tape drive.
mount /dev/da1s1a /mnt [scsi]
mount /dev/wd1s1a /mnt [ide]
Then do a "df" on the box which is houseing the new disk to be sure the partition has mounted to /mnt. If /mnt dose not show up it means the partition did not mount. :)
Now:
cd /mnt
rsh milk.code-donkey.org -use this if you are not connected to the box which is hosting the disk which is being restored.-
[scsi]
You should not need to move the tape to the next postition. Provided you are following the order
which the partitions were backed up. Always check the partition after you have restored it, so that you can be sure the correct information was installed on the partition.
"mt fsf" is used to move the tape to the first block of the next file. It will move you from
/ to /usr on the tape.
You need to dismount /dev/da1s1a [or /dev/wd1s1a] from /mnt and then mount the next partition to /mnt
cd / [You can not dismount a partition while you are it.]
umount /mnt
mount /dev/da1s1f /mnt [scsi]
mount /dev/wd1s1f /mnt [ide]
Then do a "df" to be sure the partition has mounted.
Now:
cd /mnt
Then:
rsh milk.code-donkey.org -use this if you are not connetcte to the box which is hosting the disk which is being restored.-
[scsi]
mt fsf is used to move the tape to the first block of the next file. It too move you from / to /usr on the tape.
You need to dismount /dev/da1s1f from /mnt and then mount the next partition to /mnt
cd /
umount /mnt
mount /dev/da1s1e /mnt [scsi]
mount /dev/wd1s1e /mnt [scsi]
Then do a "df" to be sure the partition has mounted.
Now:
cd /mnt
rsh milk.code-donkey.org -use this if you are not connetcte to the box which is hosting the disk which is being restored.-
[scsi]