用ZFS rollback还原根系统

ZFS作为根文件系统被集成到solaris中是从b90开始的。到底有什么好处呢?这有个例子。
因为要做ZFS crypto测试,于是以ZFS为根装好系统后,准备bfu到一个ZFS crypto版本。考虑到可能的潜在系统危险,先给整个系统打一个snapshot。

# zfs snapshot -r rootpool@freshinstall

然后bfu,reboot。果然让我碰上了,系统开始不停地在启动阶段panic。看来得试一试用zfs rollback功能恢复,重启后在grub中选择failsafe模式进入。

# zpool import
  pool: rootpool
    id: 3421507135120447382
 state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
        the '-f' flag.
   see: http://www.sun.com/msg/ZFS-8000-EY
config:
        rootpool    ONLINE
          c1t2d0s0  ONLINE

显然,ZFS pool是在的,就是有问题导致无法加载和启动。
重新导入rootpool

# mount -o rw,remount /
# zpool import -f rootpool
libshare SMF initialization problem: entity not found
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rootpool                                9.18G  24.3G    36K  /rootpool
rootpool@freshinstall                   21.5K      -    36K  -
rootpool/ROOT                           5.61G  24.3G    18K  legacy
rootpool/ROOT@freshinstall                  0      -    18K  -
rootpool/ROOT/zfsroot                   5.61G  24.3G  4.88G  /
rootpool/ROOT/zfsroot@freshinstall       619M      -  5.04G  -
rootpool/ROOT/zfsroot/var                135M  24.3G   133M  /var
rootpool/ROOT/zfsroot/var@freshinstall  2.33M      -   132M  -
rootpool/dump                           1.78G  24.3G  1.78G  -
rootpool/dump@freshinstall                16K      -  1.78G  -
rootpool/export                           52K  24.3G    19K  /export
rootpool/export@freshinstall              15K      -    19K  -
rootpool/export/home                      18K  24.3G    18K  /export/home
rootpool/export/home@freshinstall           0      -    18K  -
rootpool/swap                           1.78G  26.1G    16K  -
rootpool/swap@freshinstall                  0      -    16K  -

回退到@freshinstall

# zfs rollback -r rootpool@freshinstall
# zfs rollback -r rootpool/ROOT@freshinstall
# zfs rollback -r rootpool/ROOT/zfsroot@freshinstall
# zfs rollback -r rootpool/ROOT/zfsroot/var@freshinstall
# reboot

系统重新启动后,可以正常启动。

Comments:

I'm curious that I didn't heard ZFS-crypto support ZFS root yet :)
Basically, it's not support at current phase.

Posted by Robin Guo on July 08, 2008 at 05:23 AM CST #

Yeah. You are right, Robin.
I just used it to reach the panic situation. :-) Just for example.

Posted by forrest on July 08, 2008 at 06:08 AM CST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

forrest

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today