Table of Contents
In this handbook we will see how you can create a software RAID-1 with GPT on a FreeBSD host.
This setup has been tested and is working properly under FreeBSD 8.0.
In the following handbook we will see how to setup a freshly installed FreeBSD 8.0 system with RAID-1 support and GPT.
You can also use this guide in order to migrate your MBR to GPT.
One more thing to add about this documentation is that we are going to create mirror of the partitions instead of the whole disks.
NOTE: In this documentation we will see how to create a RAID-1 on a FreeBSD host. During the implementation of the RAID-1 we will be creating mirror for the partitions, instead of the whole disks.
Some of you may be wondering what is the benefit of this approach, so here is a short list of pros and cons when using this approach.
Pros for creating mirror of the partitions, instead of the whole disks:
Cons for creating mirror of the partitions, instead of the whole disks:
NOTE: Starting from FreeBSD 8.2 gpart(8) now supports two additional options - backup and restore, which makes it very easy to recover your partitions when needed.
So to summarize this again - in this handbook we will show you a different approach of creating a RAID-1 on a FreeBSD host for partitions only and also how you can migrate from MBR to GPT.
There are a lot of different approaches you can use in order to get FreeBSD booting from a GPT partition table. Currently sysinstall does not have support to create GPT scheme on your disks, so we will have to do this manually.
With the above being said, lets go into the real stuff..
The first method demonstrates how we can make a fresh FreeBSD install with RAID-1 and GPT.
NOTE: During the installation we will refer to the first disk as ad4 and the second disk as ad6.
Install FreeBSD 8.0 or later. Make partitions only on the first disk.
When you reach the Disklabel Editor menu, create the following partitions on the first slice of the first disk. We won't be touching the second disk at all during the installation of the system.
Create the following partitions - root, swap, usr, tmp and var. Each of these partitions is of the following sizes: root - 1GB, swap - 1GB, tmp - 1G, usr - 4GB and var - 1G.
NOTE: The reason that I've chosen these sizes for the partitions is that these partitions are actually going to be temporary and used only during the installation. Later in this document we will be re-creating the disk partition scheme.
So after I've created my partitions on the first disk, the layout is as follows:
Perform a Minimal install and go throught the post-install configuration steps.
Now that you have installed FreeBSD, boot into your freshly installed system and create backups of the partitions you have. We will restore their contents later when we create the GPT disk scheme.
You may want to use an external USB disk to store the backups or copy the backups on some other machine once you are done with them. In the following example I'm using an external USB disk to store the backups - da0.
So let's go ahead and create those backups.
Create a filesystem on the USB disk, if you haven't done this already.
Now mount the USB disk:
Now make a backup of each partition you have - root, var, tmp, usr.
If you do not have a USB disk, you may want to copy over the backups to another machine using OpenSSH. To do this just create the backups this way:
Once ready with the backups, unmount the USB disk if you have used one:
Now we can continue to the next step - creating the GPT disk scheme.