- 建立整個rpool的快照
root@solaris:/# zfs list -t snapshotNAME USED AVAIL REFER MOUNTPOINT
rpool/ROOT/solaris11@install 7.14M - 1.92G -
rpool/ROOT/solaris11@2014-09-11-14:27:28 55.3M - 2.06G -
rpool/ROOT/solaris11@2014-09-11-14:36:12 55.3M - 2.06G -
rpool/ROOT/solaris11@2014-10-06-09:25:37 64.8M - 2.07G -
rpool/ROOT/solaris11/var@install 90.1M - 96.7M -
rpool/ROOT/solaris11/var@2014-09-11-14:27:28 614K - 97.9M -
rpool/ROOT/solaris11/var@2014-09-11-14:36:12 654K - 98.0M -
rpool/ROOT/solaris11/var@2014-10-06-09:25:37 61.4M - 136M -
root@solaris:/#
root@solaris:/# zfs snapshot -r rpool@2015-01-13
root@solaris:/# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
rpool@2015-01-13 0 - 4.58M -
rpool/ROOT@2015-01-13 0 - 31K -
rpool/ROOT/solaris@2015-01-13 0 - 2.29G -
rpool/ROOT/solaris-backup-1@2015-01-13 0 - 2.06G -
rpool/ROOT/solaris-backup-1/var@2015-01-13 0 - 98.1M -
rpool/ROOT/solaris/var@2015-01-13 0 - 102M -
rpool/ROOT/solaris11@install 7.14M - 1.92G -
rpool/ROOT/solaris11@2014-09-11-14:27:28 55.3M - 2.06G -
rpool/ROOT/solaris11@2014-09-11-14:36:12 55.3M - 2.06G -
rpool/ROOT/solaris11@2014-10-06-09:25:37 64.8M - 2.07G -
rpool/ROOT/solaris11@2015-01-13 0 - 2.08G -
rpool/ROOT/solaris11-backup-1@2015-01-13 0 - 2.07G -
rpool/ROOT/solaris11-backup-1/var@2015-01-13 0 - 136M -
rpool/ROOT/solaris11/var@install 90.1M - 96.7M -
rpool/ROOT/solaris11/var@2014-09-11-14:27:28 614K - 97.9M -
rpool/ROOT/solaris11/var@2014-09-11-14:36:12 654K - 98.0M -
rpool/ROOT/solaris11/var@2014-10-06-09:25:37 61.4M - 136M -
rpool/ROOT/solaris11/var@2015-01-13 0 - 101M -
rpool/VARSHARE@2015-01-13 0 - 88K -
rpool/dump@2015-01-13 0 - 768M -
rpool/export@2015-01-13 0 - 322M -
rpool/export/home@2015-01-13 0 - 730M -
rpool/fs1@2015-01-13 0 - 31K -
rpool/swap@2015-01-13 0 - 1.00G -
root@solaris:/#
修改/etc/hosts檔,隨意加入一些字元
root@solaris:/# vi /etc/hosts
root@solaris:/# more /etc/hosts
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Internet host table
#
::1 localhost
127.0.0.1 solaris localhost loghost
192.168.1.110 client
10.10.10.10 test.cht.com.tw #instanceName
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
root@solaris:/#
在/var/crash目錄touch 三個檔案做rollback測試使用
root@solaris:/var/crash# ls -al
total 9
drwx------ 2 root sys 5 Jan 13 18:41 .
drwxr-xr-x 8 root root 8 Sep 5 01:30 ..
-rw-r--r-- 1 root root 0 Jan 13 18:41 123
-rw-r--r-- 1 root root 0 Jan 13 18:41 345
-rw-r--r-- 1 root root 0 Jan 13 18:41 789
root@solaris:/var/crash#
- 還原snapshot
PS. 每個個別的子快照也必須還原
root@solaris:~# zfs rollback -r rpool/ROOT@2015-01-13root@solaris:~# zfs rollback -r rpool/ROOT/solaris@2015-01-13
root@solaris:~#llback -r rpool/ROOT/solaris/var@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11-backup-1@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11-backup-1/var@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11/var@2015-01-13
root@solaris:~# zfs rollback -r rpool/VARSHARE@2015-01-13
此時系統檔案會回復到snapshot快照當時的狀態
沒有留言:
張貼留言