FreeBSD下ZFS RaidZ硬盘替换扩容实践

创建一个raidz1的ZFS pool
test# zpool create zfspool raidz da1 da2 da3
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 23.9G 192K 23.9G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
da1 ONLINE 0 0 0
da2 ONLINE 0 0 0
da3 ONLINE 0 0 0

errors: No known data errors

用更大的da4、da5、da6替换原来小的da1、da2、da3 Continue reading

FreeBSD下ZFS mirror升降级、硬盘替换和在线/离线扩容实践

创建一个非冗余的ZFS pool
test# zpool create zfspool da1
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 7.94G 110K 7.94G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
da1 ONLINE 0 0 0

errors: No known data errors

增加一个盘,升级为双路mirror
test# zpool attach zfspool da1 da2
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 7.94G 112K 7.94G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: resilver completed with 0 errors on Tue Jul 21 21:24:27 2009
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
mirror ONLINE 0 0 0
da1 ONLINE 0 0 0
da2 ONLINE 0 0 0

errors: No known data errors

如果想直接建立一个双路mirror的ZFS pool用
test# zpool create zfspool mirror da1 da2

再增加一个盘,升级为三路mirror Continue reading

FreeBSD下ZFS在线替换硬盘扩容实践

替换前
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 9.94G 1.96G 7.98G 19% ONLINE –

用da2替换da1,都是/dev/下的设备
test# zpool replace zfspool da1 da2

开始替换了
test# zpool status
pool: zfspool
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.
scrub: resilver in progress, 15.24% done, 0h4m to go
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
replacing ONLINE 0 0 0
da1 ONLINE 0 0 0
da2 ONLINE 0 0 0

errors: No known data errors

替换完成了
test# zpool status
pool: zfspool
state: ONLINE
scrub: resilver completed with 0 errors on Sat May 9 16:49:35 2009
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
da2 ONLINE 0 0 0

errors: No known data errors

容量增加了
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 17.9G 1.96G 16.0G 10% ONLINE –

整个过程中应用没有中断