Software RAID-1 on FreeBSD gmirror howto
freebsd geom mirror howto
I did RAID-1 on the FreeBSD 7.1-RELEASE with two identical HDD – WD15EARS (1,5Tb)
I think you can use any hhd on condition that firs device have to be smoller size than second.
in my case:
- FreeBSD detect it as ad10 and ad16
- System has been installed in ad10 (with standard boot loader)
Before starting you have to do this:
howtobsd#sysctl kern.geom.debugflags=16
next you can add you device where has installed your system (In my situation it is ad10)
howtobsd#gmirror label -v -b round-robin gm0 /dev/ad10
Metadata value stored on /dev/ad10.
Done.
and add kernels module gmirror:
howtobsd#echo geom_mirror_load="YES" >> /boot/loader.conf
I’d advice you to backup your current version of fstab before editing:
howtobsd#cp /etc/fstab /etc/fstab.backup
edit your fstab-file very carefully.
howtobsd#vim /etc/fstab
you have to change /dev/ad10xxx on /dev/mirror/gm0xxx – (very carefully! you mustn’t forget “/mirror“)
my fstab before:
# Device Mountpoint FStype Options Dump Pass#
/dev/ad10s1b none swap sw 0 0
/dev/ad10s1a / ufs rw 1 1
/dev/ad10s1d /tmp ufs rw 2 2
/dev/ad10s1e /usr ufs rw 2 2
/dev/ad10s1f /var ufs rw 2 2
/dev/ad10s1g /vol1 ufs rw 2 2
/dev/ad10s1h /vol2 ufs rw,userquota 2 2
my fstab after:
# Device Mountpoint FStype Options Dump Pass#
/dev/mirror/gm0s1b none swap sw 0 0
/dev/mirror/gm0s1a / ufs rw 1 1
/dev/mirror/gm0s1d /tmp ufs rw 2 2
/dev/mirror/gm0s1e /usr ufs rw 2 2
/dev/mirror/gm0s1f /var ufs rw 2 2
/dev/mirror/gm0s1g /vol1 ufs rw 2 2
/dev/mirror/gm0s1h /vol2 ufs rw,userquota 2 2
going to reboot
and finally add second hdd in raid massive:
howtobsd#gmirror insert gm0 /dev/ad16
at this moment system started background mirroring
you can check status of rebuilding:
howtobsd# gmirror status
Name Status Components
mirror/gm0 DEGRADED ad10
ad16 (0%)
or more verbose:
howtobsd# gmirror list
Geom name: gm0
State: DEGRADED
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 2858761865
Providers:
1. Name: mirror/gm0
Mediasize: 1500301909504 (1.4T)
Sectorsize: 512
Mode: r8w7e8
Consumers:
1. Name: ad10
Mediasize: 1500301910016 (1.4T)
Sectorsize: 512
Mode: r1w1e1
State: ACTIVE
Priority: 0
Flags: DIRTY
GenID: 0
SyncID: 1
ID: 1691608728
2. Name: ad16
Mediasize: 1500301910016 (1.4T)
Sectorsize: 512
Mode: r1w1e1
State: SYNCHRONIZING
Priority: 0
Flags: DIRTY, SYNCHRONIZING
GenID: 0
SyncID: 1
Synchronized: 0%
ID: 1437675374
Synchronization can go on a long time (in my case about 7 hours)
Congratulate! When synchronized obtain 100% you can cut off one of your hdd and try to boot system for checking efficiency of RAID1 massive.
Oh…at last…
If one of your HDDs out of order – replace defective HDD and give command:
howtobsd#gmirror forget gm0
howtobsd#gmirror insert gm0 /dev/ad16
Posted on Апрель 10th, 2010 by admin
Filed under: Software