ubuntu 20.04 LTS,开机后需要手工zpool import,否则zfs没有挂载
手工执行/sbin/zpool import -c /etc/zfs/zpool.cache -aN,如果出错则用 zpool reguid <pool> 更新zpool.cache
创建目录和文件/etc/systemd/system/zfs-import-cache.service.d/override.conf,内容为
[Unit]
After=multipathd.service
ubuntu 20.04 LTS,开机后需要手工zpool import,否则zfs没有挂载
手工执行/sbin/zpool import -c /etc/zfs/zpool.cache -aN,如果出错则用 zpool reguid <pool> 更新zpool.cache
创建目录和文件/etc/systemd/system/zfs-import-cache.service.d/override.conf,内容为
[Unit]
After=multipathd.service
FreeBSD升级后,添加用户出错adduser: ERROR: There was an error adding user
需要:
zpool upgrade -a
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
/usr/target /usr/mount-point nullfs rw,late 0 0
注意必须在Options中添加“late”,否则启动的时候报错。
创建一个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
创建一个非冗余的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
替换前
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 –
整个过程中应用没有中断