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
test# zpool replace zfspool da1 da4
test# zpool replace zfspool da2 da5
test# zpool replace zfspool da3 da6
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 23.9G 198K 23.9G 0% ONLINE –
test# zpool status
pool: zfspool
state: ONLINE
scrub: resilver completed with 0 errors on Wed Jul 22 11:10:58 2009
config:

NAME STATE READ WRITE CKSUM
zfspool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
da4 ONLINE 0 0 0
da5 ONLINE 0 0 0
da6 ONLINE 0 0 0

errors: No known data errors

导入导出pool后就能看到和使用新增加的容量了
test# zpool export zfspool
test# zpool import zfspool
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 29.9G 192K 29.9G 0% ONLINE –

解释一下raidz的磁盘容量显示,zpool list是把冗余数据也算进去了,df/du则显示实际使用容量
test# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
zfspool 1.48G 1.35G 141M 90% ONLINE –
test# df -h
Filesystem Size Used Avail Capacity Mounted on
zfspool 980M 918M 62M 94% /zfspool
test# du -h /zfspool/
918M /zfspool/

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*

code

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据