# gpt+gmirror



## raVen (Mar 18, 2013)

I am trying to understand how to create gmirror with a GPT partition table. All of the how-tos in the whole internet starting from [cmd=]gmirror label gm0 ada0 ada1[/cmd] which is totally incorrect, because of replacing failed hard disk will be impossible if size of new hard disk will be bit smaller than size of mirror.

The correct way with slices was [cmd=]gmirror label gm0s1 ada0s1 ada1s1[/cmd], with size of slices reduced by 10-20 MB of hard disk size, but GPT doesn't have slices. Another way is creating separate mirrors for each GPT partition. This way is wrong too, cause after emergency reboot or power down all that mirrors will try rebuild simultaneously. While rebuilding performance of server storage system will be reduced dramatically or even halt until rebuild completed.

So, which is the correct way to user gmirror with GPT-like slices? I know about zfs, but I can't set it up at the moment, because of low memory on my servers.


----------



## kpa (Mar 18, 2013)

Do you have to use GPT? You can still use MBR partitioning with slices. Just leave enough empty space at the end of the disk to avoid problems with different sized disks.


----------



## raVen (Mar 18, 2013)

*I* have to use GPT, *be*cause MBR is unable to work with disks larger than 2TB.


----------



## wblock@ (Mar 18, 2013)

Mirror GPT partitions, but only create one data partition per drive to prevent head contention.  Bootcode and other partitions will not be mirrored, so would have to be set up manually when a drive fails.


----------



## kpa (Mar 18, 2013)

Not sure how this would work but you could create a partition of type freebsd that covers the needed area of the disk leaving enough empty space at the end to accomodate different sized disks. Then create the mirror using the "slices" and use an equivalent of bsdlabel(8) on the mirror to divide it further.

`# gpart create -s GPT ada0`
`# gpart create -s GPT ada1`


Bootcode not mirrored:
`# gpart add -t freebsd-boot -s 64k ada0`
`# gpart add -t freebsd-boot -s 64k ada1`


The "slices" that get mirrored:
`# gpart add -t freebsd -s nnnG ada0`
`# gpart add -t freebsd -s nnnG ada1`

`# gmirror label mymirror ada0p2 ada1p2`

`# gpart add -t freebsd-ufs -s xxxG mymirror`

And so on.


----------

