snapmirror有两个条件:(1)、目的卷是restricted,(2)目的卷大小大于或等于源卷
下面开始实验
1、在目的端使目的卷restricted
DataOnTap2> vol restrict vol1
Volume 'vol4' is now restricted.
2、如果执行下面这句命令时报错,DataOnTap2> snapmirror initialize -S 172.20.10.214:vol1 DataOnTap2:vol1
Fri Sep 16 05:25:23 GMT [DataOnTap2: replication.dst.err:error]: SnapMirror: destination transfer from 172.20.10.214:vol1 to vol1: transfer from source not possible; snapmirror may be misconfigured, the source volume may be busy or unavailable.
Transfer aborted: transfer from source not possible; snapmirror may be misconfigured, the source volume may be busy or unavailable.
则只需在源端执行
DataOnTap> options snapmirror.access host=all
3、目的端重新执行
DataOnTap2> snapmirror initialize -S 172.20.10.214:vol1 DataOnTap2:vol1
Transfer started.
Monitor progress with 'snapmirror status' or the snapmirror log.
源端:
4、传输成功后,即status从“Transferring”变成“idle”后,可以看到源端和目的端的vol卷都相同
DataOnTap> df -h
Filesystem total used avail capacity Mounted on
/vol/vol0/ 647MB 144MB 503MB 22% /vol/vol0/
/vol/vol0/.snapshot 161MB 80MB 81MB 49% /vol/vol0/.snapshot
/vol/vol1/ 160MB 92MB 67MB 58% /vol/vol1/
/vol/vol1/.snapshot 40MB 180KB 39MB 0% /vol/vol1/.snapshot
目的端
DataOnTap2> df -h
Filesystem total used avail capacity Mounted on
/vol/vol0/ 647MB 144MB 502MB 22% /vol/vol0/
/vol/vol0/.snapshot 161MB 79MB 82MB 49% /vol/vol0/.snapshot
/vol/vol1/ 160MB 92MB 67MB 58% /vol/vol1/
/vol/vol1/.snapshot 40MB 140KB 39MB 0% /vol/vol1/.snapshot
5、在源端新增加一个文件cap2
6、可以看到源端的状态又变成“Transferring”
DataOnTap> snapmirror status
Snapmirror is on.
Source Destination State Lag Status
DataOnTap:vol1 DataOnTap2:vol1 Source 00:01:24 Transferring
等状态变为idle后,目的端可以看到
DataOnTap2> df -h
Filesystem total used avail capacity Mounted on
/vol/vol0/ 647MB 144MB 502MB 22% /vol/vol0/
/vol/vol0/.snapshot 161MB 79MB 82MB 49% /vol/vol0/.snapshot
/vol/vol1/ 160MB 110MB 49MB 69% /vol/vol1/
/vol/vol1/.snapshot 40MB 144KB 39MB 0% /vol/vol1/.snapshot
说明已经同步完成
7、在目的端删除某一文件,无法删除,因为此时是绑定状态
断开绑定
DataOnTap2> snapmirror break -f vol1
snapmirror break: Destination vol1 is now writable.
Volume size is being retained for potential snapmirror resync. If you would like to grow the volume and do not expect to resync, set vol option fs_size_fixed to off.
8、再次删除可以成功
9、也可以通过GUI方式查看snapmirror状态