Category Archives: cyber

Getting gmirror to work

here are steps: those followed by “queen#” are the things I typed…
the rest are computer responses.

gmirror is a software raid program in linux. I use it to duplicate drives in case one fails.

7 and half steps to RAID-1 (mirror).

1. queen# sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16
2. queen# gmirror label -v -b round-robin gm0 /dev/ad4
Metadata value stored on /dev/ad4.
3. queen# echo geom_mirror_load=”YES” >> /boot/loader.conf
4. queen# cp /etc/fstab /etc/fstab.orig
5. queen# vi fstab (to make the file like below..add /mirror, change “ad4” to “gm0”)

# Device Mountpoint FStype Options Dumirrorp Pass#
/dev/mirror/gm0s1b none swap sw 0 0
/dev/mirror/gm0s1a / ufs rw 1 1
/dev/mirror/gm0s1e /tmp ufs rw 2 2
/dev/mirror/gm0s1f /usr ufs rw 2 2
/dev/mirror/gm0s1d /var ufs rw 2 2
/dev/mirror/acd0 /cdrom cd9660 ro,noauto 0 0

6. reboot and add 2nd drive
6.5 check dmesg for new drive ID, it is shown as
ad8: 953869MB at ata4-master SATA300, so:

7. queen# gmirror insert gm0 /dev/ad8
done (at 4:09 pm)! to check progress:
8. queen# gmirror list (7% done at 4:28)

> gmirror list
Geom name: gm0
State: DEGRADED
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3818422309
Providers:
1. Name: mirror/gm0
Mediasize: 1000204885504 (932G)
Sectorsize: 512
Mode: r6w5e14
Consumers:
1. Name: ad4
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r1w1e1
State: ACTIVE
Priority: 0
Flags: NONE
GenID: 0
SyncID: 1
ID: 2725896007
2. Name: ad8
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r1w1e1
State: SYNCHRONIZING
Priority: 0
Flags: DIRTY, SYNCHRONIZING
GenID: 0
SyncID: 1
Synchronized: 7%
ID: 128357503

23 min uptime, 10% done. so it will take 230 min which is almost 4 hrs for 1000 gig (not sure if it will slow down if with more contents, right now it is running x11, apache, php and mysql — all working).