Subject: mirroring harddrives [was Re: Cloning an Amiga harddrive ?]
To: Chuck Yerkes <chuck+nbsd@2003.snew.com>
From: webmaster@datazap.net <webmaster@datazap.net>
List: netbsd-help
Date: 12/24/2002 12:22:01
Hi,

On Sun, 22 Dec 2002, Chuck Yerkes wrote:

> It's a different drive.  Without being pedantic, "clone" brings up
> the image of exact duplication.  You want to "MOVE" the data from
> one drive to another.  It seems minor, but leads to entirely different
> techniques.

This is true I didn't use the best terminology when I wrote this email. I
was really tired and was in a big hurry. Sorry!


> I've done this a lot over the years, for several Unixes.
>
>
> TWO first paths:
> 1) Boot from old disk.  Setup and partition the new disk, perhaps
>    even with a new/fresh install that you will toss later.  Perhaps
>    test that it boots from this second disk - just as a throwaway.
>    It did?  Good.  Skip past next para.
>
> 2) Less downtime:  Take your development/test box, install NetBSD
>    onto it.  Make sure it boots.  Now the disks are formatted right.
>    Continue.
>
>
> Now you want to boot from the original disk and MOVE the data to the
> new disk.  The machine can be mostly live.
> "newfs" the NBSD partitions on the new disk.  Mount them under,
> hmmm, /NEW/  as needed (/NEW and /NEW/usr and /NEW/var, etc).  Now
> the new disk is clean and ready to be written.
>
> You offer tar and pax.  Use dump/restore.  You tar/pax to files
> that you don't have room for.  Don't use files, use pipes.

I should have made this clear too. My root partition is only about 150
megs, and there would be enough room on /usr to hold the root tar ball.
The reason that I would tar the root partition is because I know that tar
would not cross over the mount points. I would then use pax to copy every
thing else directly to the new drive.

> And where are your backup tapes for this "production system"
> You CAN build a new machine from tapes...  If you can't, you
> should be able to.  DataZap indeed.

I don't have a tape drive. I must admit that I really
wanted one, but it wasn't in the budget. So, I don't exactly have a backup
tape. I did make a backup, but it is on another computer.


> Dump(8) each partition to STDOUT and pipe into a restore
> For the /, try
>   dump 0af - / | (cd /NEW; restore -rf -)
>
> (check the dump options, I'm looking at another BSD's manpages; level
> 0, autosize, to file STDOUT)
>
> Repeat for all filesystems.  Then make what you need to make bootblocks.
> STOP!  If it was in production and stuff was being written to during
> the dump, take a second.  With the "new" disk mounted under /NEW...
> for each filesystem run "rsync -avHx --delete / /NEW/"
> (trailing / is important).  This says: without traversing mount
> points, rsync and keep hard/softlinks, delete missing files and
> make /NEW/ the same as /.  Do this for /usr/ & /NEW/usr/,
> /var/ & /NEW/var/, etc.
>
> Note that / really shouldn't change during production - just apps
> running.  I expect logs, databases and perhaps other data to vary,
> but not the configs or binaries things.  (reason # 35 why /usr
> and / are not the same partition as /var/ and other data partitions).
>
> Unmount all of /NEW, pull the disk and test boot it on your
> test system.
>
> ELSE pull the orig disk and boot from the new one.
>
> If you don't have a test/devel system, then you do.  You just don't
> have a production system.

Maybe "production system" was a poor choice of words here too. Maybe I
should have said that Agnus is a "live server", and there are a lot of
people who are counting on me to keep it running. (I have over 2,000
accounts on this box). Although right now I only use about 3 to 4 gigs of
bandwidth a day (This is all the cable modem can handle), which is down
from 14+ gigs a day. So, right now is actually a good time to make the
change.

I wish that I would have thought of it before, but at work we have a bunch
of P3s that almost never get used, except for testing (I work for an ISP).
I just happen to have NetBSD installed on one of them.  I will just need a
second hard drive (I am sure that we have one laying around at work), and
I will be able to run some tests.

Thanks,
Al