mirror without destroying existing contents

John Nielsen lists at jnielsen.net
Tue Mar 13 19:42:06 UTC 2007


On Tuesday 13 March 2007 15:12, Steve Franks wrote:
> Anyone made a mirror w/o destroying what's in the disk already?  The
> atacontrol man page is less than adequate in this respect...is is even
> possible?

If you want to use gmirror (which I recommend), the most conservative approach 
is as follows. This can probably be adapted to other mirroring 
techniques/software as well.

Verify that your backups are up-to-date and reliable.

Create a "degraded" single-member mirror on the blank disk (or a 
partition/slice on said disk). (gmirror label command) Make sure that the 
size of the disk/slice/partition is equal to or smaller than the size of the 
disk/slice/partition which already contains your data.

Create (a) new filsystem(s) on the new mirror. (newfs and possibly bsdlabel, 
depending on how/if you want to break it up)

Transfer your data from the existing filesystem to the new filesystem 
(dump/restore -- it's easier than it sounds). (Alternative: restore from the 
backup you created to begin with.)

Verify data transfer, make relevant changes to /etc/fstab, possibly other 
intermediate steps.

Destroy the original filesystem (possibly using dd and /dev/zero) (not 
strictly necessary, but wiping at least the first part of the 
disk/slice/partition can help avoid potential confusion (for you and the 
system) later.)

Insert the original disk/slice/partition into your new mirro (gmirror insert 
command).

This approach can take longer than some others (due to the transfer 
requirement), but the finished product is less likely to contain surprises. I 
have successfully used this approach to migrate several types of volumes to 
gmirror sets, including boot partitions.

JN


More information about the freebsd-questions mailing list