Let's prove it. I spun up two VMs with FreeBSD 9.1. Host vm20 has address 10.100.82.20 and host vm10 has address 10.100.82.10.
On both: Create some disks.
Code:
dd if=/dev/zero of=/root/disk1 bs=1M count=100
dd if=/dev/zero of=/root/disk2 bs=1M count=100
On both: A quick
/etc/hast.conf
Code:
resource disk1 {
on vm20 {
local /root/disk1
remote 10.100.82.10
}
on vm10 {
local /root/disk1
remote 10.100.82.20
}
}
resource disk2 {
on vm20 {
local /root/disk2
remote 10.100.82.10
}
on vm10 {
local /root/disk2
remote 10.100.82.20
}
}
On both: Create the HAST disks and start the service
Code:
hastctl create disk1
hastctl create disk2
service hastd onestart
On the primary: Initialize as the primary role
Code:
hastctl role primary disk1
hastctl role primary disk2
On the secondary: Initialize as the secondary role
Code:
hastctl role secondary disk1
hastctl role secondary disk2
Back to the primary: Create a zpool, put some files on it, and scrub it.
Code:
zpool create zmirror mirror /dev/hast/disk1 /dev/hast/disk2
cp -R /usr/sbin/ /zmirror/
zpool scrub zmirror
zpool status
Obviously we are fine at this point, so let's break it.
Code:
dd if=/dev/zero of=/root/disk1 bs=1M count=75
zpool scrub zmirror
zpool status
... output omitted
scan: scrub repaired 43.7M in 0h0m with 0 errors on Thu Sep 12 18:26:01 2013
... output omitted
zpool clear zmirror
On the secondary:
Code:
dd if=/dev/zero of=/root/disk1 bs=1M count=75
On the primary:
Code:
zpool scrub zmirror
zpool status
... output omitted
scan: scrub repaired 0 in 0h0m with 0 errors on Thu Sep 12 18:27:11 2013
So no error even though we damaged the secondary's disk. Lets switch roles.
On the primary:
Code:
zpool export zmirror
hastctl role secondary disk1
hastctl role secondary disk2
On the secondary (soon to be primary)
Code:
hastctl role primary disk1
hastctl role primary disk2
zpool import zmirror
zpool status
... output omitted
state: DEGRADED
... output omitted
13192269359050368896 UNAVAIL 0 0 0 was /dev/hast/disk1
After the import it didn't seem to like the disk1 anymore. I would guess the loss of HAST metadata since I damaged such a large swath of a small disk had something to do with it. Let's fix it.
Code:
hastctl create disk1
hastctl role primary disk1
zpool scrub zmirror
zpool status
... output omitted
state: ONLINE
scan: scrub repaired 44.5K in 0h0m with 0 errors on Thu Sep 12 18:33:36 2013
Something to keep in mind from
https://wiki.freebsd.org/HAST:
HAST can be compared to a RAID1 (mirror) where one of the components is local disk (on primary node) and second component is disk on remote machine (secondary node). Every write, delete or flush operation (BIO_WRITE, BIO_DELETE, BIO_FLUSH) is sent to local disk and to remote disk over TCP connection (if secondary node is available). Every read operation (BIO_READ) is served from local disk, unless local disk isn't up-to-date or an I/O error occurs, then read operation is sent to secondary node (if it is, of course, available).
In summary, it would appear that since HAST reads only go to the local disk then there is is nothing a
zpool scrub can do. Having planned maintenance to regularly switch roles and do a scrub seems required.