好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Solaris zfs更换根池磁盘(Replace a Disk in the ZFS Root

Solaris zfs更换根池磁盘(Replace a Disk in the ZFS Root Pool)

 

某些时候,由于空间不足或是硬件故障等原因,我们需要更换启动磁盘。

 

冗余池(mirrored pool)

在一个镜像池里面更远硬盘相对简单一些,只需要用replace命令直接更换硬盘即可。

<Physically remove failed disk c1t0d0>

<Physically insert replacement disk c1t0d0>

# zpool status rpool

<Let disk resilver before installing the boot blocks>

 

非冗余池

如果根池不是mirrored,那么就需要先把新磁盘分区好,加入根池形成mirrored类型的池。

加入新盘并检测

# devfsadm

 

分区并打标签

 

format> partition

SELECT ONE OF THE FOLLOWING:

   1. Create a partition

...

 

partition> print

Current partition table (original):

Total disk cylinders available: 30398 + 2 (reserved cylinders)

 

Part Tag Flag Cylinders Size Blocks

partition>quit

 

format> label

[0] SMI Label

[1] EFI Label

Ready to label disk, continue? y

添加磁盘

现在把做好的新磁盘分区加入根池形成镜像池,这一步里数据的同步可能会花费比较长的时间

Make sure to wait until resilver is done before rebooting.

 

# zpool status

  pool: rpool

 state: ONLINE

status: One or more devices is currently being resilvered. The pool will

        continue to function, possibly in a degraded state.

action: Wait for the resilver to complete.

    302M scanned out of 7.47G at 11.2M/s, 0h10m to go

    269M resilvered, 3.95% done

config:

 

        NAME STATE READ WRITE CKSUM

            c0d2s0 ONLINE 0 0 0 (resilvering)

 

errors: No known data errors

安装启动块

On a SPARC based system:

On an x86 based system:

 

验证boot

首先查看boot path

# prtconf -vp|grep -i bootpath

        bootpath: '/virtual-devices@100/channel-devices@200/disk@0:a'

可以推断出新盘path的末尾是disk@2:a,然后启动

{0} ok setenv boot-device /virtual-devices@100/channel-devices@200/disk@2:a

boot-device =           /virtual-devices@100/channel-devices@200/disk@2:a

{0} ok printenv boot-device

boot-device =           /virtual-devices@100/channel-devices@200/disk@2:a

 

ok boot /virtual-devices@100/channel-devices@200/disk@2:a

移除老磁盘

扩展池空间

由于之前的磁盘空间小于新盘,所以现在的空间是和之前一样的,需要扩展一下。

# zpool set autoexpand=on rpool

至此为止,大功告成。

 

查看更多关于Solaris zfs更换根池磁盘(Replace a Disk in the ZFS Root的详细内容...

  阅读:48次