creating a raid1 with single system drive

James D. Parra jamesp at musicreports.com
Tue Sep 9 14:01:37 UTC 2014


On 9/9/14 1:20, James D. Parra wrote:
> # zpool status
>    pool: tank0
>   state: ONLINE
>   scan: none requested
> config:
>
>          NAME        STATE     READ WRITE CKSUM
>          tank0       ONLINE       0     0     0
>            ada0s1d   ONLINE       0     0     0
Looks like a typical single drive zpool built on a partitioned drive.


>
> I wish to add an identical disk to create a raid1 array.  A list of the drives shows;
>
> ll /dev/ad*
>
> crw-r-----  1 root  operator    0, 108 Sep  8 19:21 /dev/ada0
> crw-r-----  1 root  operator    0, 110 Sep  8 19:21 /dev/ada0s1
> crw-r-----  1 root  operator    0, 115 Sep  8 19:21 /dev/ada0s1a
> crw-r-----  1 root  operator    0, 117 Sep  8 19:21 /dev/ada0s1b
> crw-r-----  1 root  operator    0, 119 Sep  8 19:21 /dev/ada0s1d
> crw-r-----  1 root  operator    0, 112 Sep  8 19:21 /dev/ada1
> crw-r-----  1 root  operator    0, 121 Sep  8 19:21 /dev/ada1s1
> crw-r-----  1 root  operator    0, 126 Sep  8 19:21 /dev/ada1s1a
> crw-r-----  1 root  operator    0, 128 Sep  8 19:21 /dev/ada1s1b
> crw-r-----  1 root  operator    0, 130 Sep  8 19:21 /dev/ada1s1d
> crw-r-----  1 root  operator    0, 132 Sep  8 19:21 /dev/ada1s1e
>
> I installed the OS on the second disk as well so the partitions would be the same. However, something doesn't appear correct.
No need for that, but from the following it looks like you installed the 
OS two different ways... Or are you running two different OSes ?

>          NAME         STATE     READ WRITE CKSUM
>          tank0        ONLINE       0     0     0
>            mirror-0   ONLINE       0     0     0
>              ada0s1d  ONLINE       0     0     0
>              ada1s1e  ONLINE       0     0     0  (resilvering)
> # gpart show
> =>        63  1953525105  ada0  MBR  (931G)
>            63        1953        - free -  (976k)
>          2016  1953523152     1  freebsd  (931G)
>
> =>         0  1953523152  ada0s1  BSD  (931G)
>             0     2097152       1  freebsd-ufs  (1.0G)
>       2097152   809500672       2  freebsd-swap  (386G)
>     811597824  1141925328       4  freebsd-zfs  (544G)
What is the 1.0 GB UFS partition for ?
> =>        63  1953525105  ada1  MBR  (931G)
>            63        1953        - free -  (976k)
>          2016  1953523152     1  freebsd  (931G)
>
> =>         0  1953523152  ada1s1  BSD  (931G)
>             0     4096000       1  freebsd-ufs  (2G)
>       4096000     4096000       2  freebsd-swap  (2G)
>       8192000     4194304       4  freebsd-ufs  (2.0G)
>      12386304  1941136848       5  freebsd-ufs  (925G)
And this does not match the above, so when you installed the OS, you 
must have given it different options.
> Although, the disks are identical, the installation partitioned them differently.
Yes, it did.
> What is the best way to create a zfs raid1 for the system drive by adding the second drive after the install?
What I have always done is install the OS to the first drive, then 
manually partition the second drive to match the first and then add the 
matching partition to the zpool. Remember to install the boot loader on 
the second drive after establishing the mirror (see gpart bootcode) so 
that you can boot from it if the first drive fails. I also keep a 
bootable USB drive near the server for booting when something goes 
horribly wrong :-)
~~~~~

Thanks Paul. The OS's are identical, however I did not use ZFS on the second install. I did that previously and when I tried to add that drive (the second drive) to the zfs pool it gave an error that it was part of another pool, although both pools were tank0. Using the force option did not help. Is there a way to have a tool (gpart?) to read the partitions from the source drive and create the matching partitions on the target drive?

Many thanks,
James



More information about the freebsd-questions mailing list