Recently I've found out about rsync and wanted to use this to mirror local disks on one of my servers. I first ran Ghost for Linux to get the exact clone I was looking for, and now I'm ready to setup rsync to keep my drives mirrored on a continual basis. Here's my setup: 1 Seagate 4.6GB SCSI on /dev/sda, mounted like this: /dev/sda1 ==> /boot - 101M /dev/sda2 ==> swap - 269M /dev/sda3 ==> / - 3.9GB 1 Seagate 16GB SCSI on /dev/sdb has the same look due to the ghost for linux clone but I need help on how I should keep this drive sync'd with the main SCSI disk, sda. I saw the script on rsync.samba.org for backing up to a spare disk but need some help understanding the coding, as well as knowing if this script will provide me with another spare disk that is a replica of the primary. From what I can make of this script it doesn't mirror the drive, it only mirrors these: rootfs, usr, data, and data2. If this script does replicate disks then he first part of it is really what I'd be looking to do. In my case I would need to mount /dev/sdb1 as "/boot" and /dev/sdb3 as "/" somewhere. Whatever tips/insight you guys can provide on this would be much appreciated. Here's the script: #!/bin/sh export PATH=/usr/local/bin:/usr/bin:/bin LIST="rootfs usr data data2" for d in $LIST; do mount /backup/$d rsync -ax --exclude fstab --delete /$d/ /backup/$d/ umount /backup/$d done thanks marshall
On Mon, Jun 14, 2004 at 09:39:04AM -0700, Marshall28 wrote:> spare disk but need some help understanding the coding, as well as knowing > if this script will provide me with another spare disk that is a replica of > the primary. From what I can make of this script it doesn't mirror the > drive, it only mirrors these: rootfs, usr, data, and data2.This script looks like it has assumed that you have four partitions "rootfs usr data data2". Probably "rootfs" is really the / partition, which the script author has somehow (outside the context of this script) made available under "/rootfs" (a symbolic link /rootfs pointing to / might do the trick). It also assumes that the /etc/fstab file has entries for the duplicate disk, with mount points under /backup. If you have differently named partitions you would want to put the names in LIST. You'll also have to resolve the "rootfs" issue. Note that one thing that this method will NOT accomplish is to update your boot loader if you install a new kernel. the -x option to rsync tells it not to cross filesystem boundaries, so that each partition on the master disk is copied to the same partition on the duplicate disk. Suggest you get yourself a good system administration book, which will explain these concepts in good depth. I recommend "unix system administration handbook" by nemeth et. al. I think they now have a linux-specific version of the book called "linux system administration handbook".> If this script does replicate disks then he first part of it is really what > I'd be looking to do. In my case I would need to mount /dev/sdb1 as "/boot" > and /dev/sdb3 as "/" somewhere. Whatever tips/insight you guys can provide > on this would be much appreciated. Here's the script: > > #!/bin/sh > > export PATH=/usr/local/bin:/usr/bin:/bin > > LIST="rootfs usr data data2" > > for d in $LIST; do > mount /backup/$d > rsync -ax --exclude fstab --delete /$d/ /backup/$d/ > umount /backup/$d > done > > > > thanks > marshall > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.htmldanno -- dan pritts danno@internet2.edu systems administrator 734/352-4953 office internet2 734/834-7224 mobile
On Mon, Jun 14, 2004 at 09:39:04AM -0700, Marshall28 wrote:> Recently I've found out about rsync and wanted to use this to mirror local > disks on one of my servers. I first ran Ghost for Linux to get the exact > clone I was looking for, and now I'm ready to setup rsync to keep my drives > mirrored on a continual basis. Here's my setup: > > 1 Seagate 4.6GB SCSI on /dev/sda, mounted like this: > /dev/sda1 ==> /boot - 101M > /dev/sda2 ==> swap - 269M > /dev/sda3 ==> / - 3.9GB > > 1 Seagate 16GB SCSI on /dev/sdb has the same look due to the ghost for linux > clone but I need help on how I should keep this drive sync'd with the main > SCSI disk, sda. I saw the script on rsync.samba.org for backing up to a > spare disk but need some help understanding the coding, as well as knowing > if this script will provide me with another spare disk that is a replica of > the primary. From what I can make of this script it doesn't mirror the > drive, it only mirrors these: rootfs, usr, data, and data2. > > If this script does replicate disks then he first part of it is really what > I'd be looking to do. In my case I would need to mount /dev/sdb1 as "/boot" > and /dev/sdb3 as "/" somewhere. Whatever tips/insight you guys can provide > on this would be much appreciated. Here's the script:rsync operates on filesystems, not partitions nor disks. So, yes, you would need to mount the partitions somewhere, e.g. /mnt/oldroot, /mnt/oldboot, and rsync between new directories and old. -chris> > #!/bin/sh > > export PATH=/usr/local/bin:/usr/bin:/bin > > LIST="rootfs usr data data2" > > for d in $LIST; do > mount /backup/$d > rsync -ax --exclude fstab --delete /$d/ /backup/$d/ > umount /backup/$d > done > > > > thanks > marshall > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html