Koozali.org: home of the SME Server

Mirroring two scsi discs

Lasse Johansson

Mirroring two scsi discs
« on: May 07, 2003, 08:04:10 PM »
Hello everbody!

I just felt like sharing a quite useful cronscript with you...

I've been running a company server for quite a while (actually, all the way from ESS&G 4.0), and it's running just wonderfully!

It's equipped with tho scsi host adapters, to each of them one attached 50 GB scsi drive (placed in a "Removable Drive Enclosure")

One of the discs is a "live disk", - the second one is just a "mirror disk".

(We also have several more "mirror disks" placed in the safe to switch between)

Every night, I run the following cron script:
(This version of the script comes from the old 4.1.2 server, but you'll probably catch the idea...)
***********************************************
#!/bin/sh

echo 'scsi add-single-device 1 0 15 0' >/proc/scsi/scsi
mke2fs /dev/sdb6
mount /dev/sdb6 /mnt/sdb6

ls / | grep -v proc |grep -v boot |grep -v mnt |grep -v lost+found
>/root/mirror_files

(cd /;tar cf - cat /root/mirror_files)|(cd /mnt/sdb6;tar xvpf -)

mkdir /mnt/sdb6/mnt
mkdir /mnt/sdb6/mnt/sdb6
mkdir /mnt/sdb6/mnt/cdrom
mkdir /mnt/sdb6/mnt/floppy
mkdir /mnt/sdb6/proc
mkdir /mnt/sdb6/boot

umount /dev/sdb6
echo 'scsi remove-single-device 1 0 15 0' >/proc/scsi/scsi
***********************************************

On the very old HW (P2 400MHz), this procedure takes about 1 hour to "mirror" something like 40 GB or so of data.

...As a result, every morning I have a complete "backup" of all the files in the system. When a user suddenly deletes an important file I can easily restore it from the "mirror" simply by copying back the file again.

Whenever I want, I can even switch the "mirror disk" to another "mirror disk", just like switching tapes in a tape recorder.

I realize this might not be the cheapest way of doing backups on a server, but it feels like the fastest...

If someone have any ideas of how to further improving the script above, I'd be very interested in sharing your thoughts.


Best regards:

Lasse

Lasse Johansson

Re: Mirroring two scsi discs
« Reply #1 on: May 08, 2003, 11:06:26 AM »
Sorry, folks!

The "two line":

ls / | grep -v proc |grep -v boot |grep -v mnt |grep -v lost+found >/root/mirror_files


...should of course be on one single line in the script.

I don't know why it didn't appear so in the phorum...