mirror without destroying existing contents

Jonathan McKeown jonathan at hst.org.za
Sun Mar 18 06:14:42 UTC 2007


On Friday 16 March 2007 21:48, Steve Franks wrote:
> On 3/16/07, John Nielsen <lists at jnielsen.net> wrote:
> > On Friday 16 March 2007 11:18, Steve Franks wrote:
> > > I get the following:
> > >
> > > #gmirror label -v -b split -s 1024 data ad0
> > > can't store metadata on ad0: operation not permitted.
> >
> > That most likely means that you currently have a filesystem on ad0
> > mounted. If that's the case you should be glad that the OS was smarter
> > than you. What steps had you taken prior to this?
>
> It appears to say in the manpage that you can do this on a disk with
> an existing filesys - would you expect it to work if the disk is
> unmounted first, then?

The way to do this is potentially a little risky but I haven't had a problem 
with it yet after setting up several mirrors on live fileservers. There is a 
sysctl called kern.geom.debugflags: if you set this to 16 it will allow you 
to change the mounted filesystem. Bear in mind that since the metadata for 
the mirror is written to the last sector of the disk, there is a small risk 
of data loss: if that sector contains data it will be overwritten.

There's a thorough howto by Ralph Engelschall, and an OnLamp article by Dru 
Lavigne, with more details:

http://people.freebsd.org/~rse/mirror/
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html

Jonathan


More information about the freebsd-questions mailing list