In this example you will setup an NFS SVM and snapvault the nfs export volume to a second SVM destination volume.
You will setup an XDP snapmirror relationship.
Then you will create file in the source volume and restore them from the destination SVM volume.
1. Create the two SVMs.
cl1::> vserver create vault_src -subtype default
-rootvolume rv -aggregate n1_aggr1 -rootvolume-security-style unix
cl2::> vserver create -vserver vault_dst -subtype default
-rootvolume rv -aggregate aggr1 -rootvolume-security-style unix
2. Peer the SVMs.
cl1::> vserver peer create -vserver vault_src -peer-vserver
vault_dst -peer-cluster cl2 -applications snapmirror
cl2::> vserver peer accept -vserver vault_dst -peer-vserver vault_src
3. Create the volumes.
cl1::> vol create -vserver vault_src -volume vault_src_vol
-aggregate n1_aggr1 -size 500m -junction-path /src
cl2::> vol create -vserver vault_dst -volume vault_dst_vol
-aggregate aggr1 -size 500m -type dp
4. Setup the snapmirror policy.
cl2::> snapmirror policy create -vserver vault_dst
-policy vaultpol
cl2::> snapmirror policy add-rule -vserver vault_dst
-policy vaultpol -snapmirror-label min -keep 5
5. Setup the snapshot policy on the source volume.
cl1::> snapshot policy create -policy vaultsnap -count1 2
-schedule1 5min -snapmirror-label1 min -vserver vault_src
-enabled true
cl1::> vol modify -vserver vault_src -volume vault_src_vol
-snapshot-policy vaultsnap
6. Create an export-policy and rule.
cl1::> export-policy create -vserver vault_src -policyname vault_nfs
cl1::> export-policy rule create -vserver vault_src -policyname vault_nfs
-clientmatch 0.0.0.0/0 -rorule any -rwrule any -superuser any
7. Change the source volume's export-policy and create nfs.
cl1::> vol modify -vserver vault_src -volume vault_src_vol
-policy vault_nfs
cl1::> vol modify -vserver vault_src -volume rv -policy vault_nfs
cl1::> nfs on -vserver vault_src
8. Create the snapmirror relationship and connect the right policy.
cl2::> snapmirror create -source-path vault_src:vault_src_vol
-destination-path vault_dst:vault_dst_vol -type XDP
cl2::> snapmirror policy create -vserver vault_dst -policy vaultpol
9. Create a LIF for the nfs source SVM.
cl1::> net int create -vserver vault_src -lif lif1 -role data
-data-protocol nfs -home-node cl1-01 -home-port e0d
-address 192.168.0.224 -netmask 255.255.255.0 -status-admin up
10. Connect to the share.
On linux
root@pi158:~# mkdir /mnt/224
root@pi158:~# mount 192.168.0.224:/ /mnt/224
root@pi158:~# cd /mnt/224/src
root@pi158:/mnt/224/src# touch a b c
11. Wait for some time and check the snapshots.
cl2::> snap show -vserver vault_dst -volume vault_dst_vol
5min.2017-05-23_1315 136KB 0% 36%
5min.2017-05-23_1320 152KB 0% 38%
5min.2017-05-23_1325 0B 0% 0%
12. Remove the files you created
root@pi158:/mnt/224/src# rm *
13. Restore the whole volume.
cl1::> snapmirror restore -destination-path vault_src:vault_src_vol
-source-path vault_dst:vault_dst_vol 5min.2017-05-23_1325
14. On linux your file should be back.
root@pi158:/mnt/224/src# ls
a b c
15. On linux remove file b and file c
root@pi158:/mnt/224/src# rm b c
16. Restore file b to file b and file c to file c_restored.
cl1::> snapmirror restore -destination-path vault_src:vault_src_vol
-source-path vault_dst:vault_dst_vol 5min.2017-05-23_1325
-file-list /b,@/b,/c,@/c_restored