Create a mirror on disk with valid data

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu Sep 29 02:02:31 PDT 2005


On Fri, Sep 16, 2005 at 02:30:12PM +0700, Victor Sudakov wrote:
+> Colleagues,
+> 
+> gmirror(8) says that a mirror can be created from a disk with existing
+> data. However, other sources like 
+> http://ezine.daemonnews.org/200502/diskmirror.html 
+> say that the mirror device should be first partitioned, labelled and
+> formatted.
+> 
+> The second way seems to me more feasible. From experimenting with
+> different disks I have found out that (according to fdisk) the size of gm0
+> is several sectors smaller than that of ad0. I said to myself, that is
+> the overhead of the gmirror metadata.
+> 
+> How could it then be possible to create a mirror from a disk with
+> existing data, like the man page suggests?  The gmirror metadata could
+> then be overwritten with user data or vice versa.
+> 
+> Any input is very much appreciated. 

You are right. Last sector is used for metadata and will be overwritten.
The example is there actually to show that you can create a mirror with
only one disk and add another one later.
I added a note to clarify that.
In real world it is really hard to trigger, because both fdisk(8) and
bsdlabel(8) like to cut much more than one sector at the end of the
disk/slice, so in most cases it is safe, but I always recommended to
dump -> [ fdisk -> bsdlabel -> ] gmirror label -> [ fdisk -> bsdlabel -> ] restore.

Thanks.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-geom/attachments/20050929/25a534dc/attachment.bin


More information about the freebsd-geom mailing list