管理 ZFS 存储池( 五 )


以下示例说明如何使用 -f 选项:
# zpool create tank c1t0d0
invalid vdev specification
use "-f" to override the following errors:
/dev/dsk/c1t0d0s0 contains a ufs filesystem.
# zpool create -f tank c1t0d0
理想的情况是,更正错误而不是使用 -f 选项 。
不匹配的复制级别
建议不要创建包含不同复制级别的虚拟设备的池 。zpool 命令可尝试防止意外创建冗余级别不匹配的池 。如果尝试创建具有这样配置的池,则会显示类似以下的错误:
# zpool create tank c1t0d0 mirror c2t0d0 c3t0d0
invalid vdev specification
use "-f" to override the following errors:
mismatched replication level: both disk and mirror vdevs are present
# zpool create tank mirror c1t0d0 c2t0d0 mirror c3t0d0 c4t0d0 c5t0d0
invalid vdev specification
use "-f" to override the following errors:
mismatched replication level: 2-way mirror and 3-way mirror vdevs are present
可以使用 -f 选项覆盖这些错误,但建议不要采用这种做法 。此命令还会发出警告,指明正使用大小不同的设备创建镜像池或 RAID-Z 池 。尽管允许此配置,但是冗余级别不匹配会导致较大设备上产生未使用的空间,并要求使用 -f 选项覆盖警告 。
在预运行模式下创建存储池
由于创建池可能以不同方式意外失败,并且格式化磁盘这一操作可能产生危害,因此 zpool create 命令具有一个附加选项 -n,此选项可用于模拟创建池,而无需实际将数据写入磁盘 。此选项执行设备使用中检查和复制级别验证,并报告该过程中出现的任何错误 。如果未找到错误,则会显示类似以下的输出:
# zpool create -n tank mirror c1t0d0 c1t1d0
would create "tank" with the following layout:
tank
 mirror
c1t0d0
c1t1d0
如果不实际创建池,则无法检测到某些错误 。最常见的示例是在同一配置中两次指定同一设备 。由于不写入数据本身便无法可靠地检测到此错误,因此 create -n 命令可能会报告运行成功,但在实际运行时又无法创建池 。
存储池的缺省挂载点
创建池时,根数据集的缺省挂载点是 /pool-name 。此目录必须不存在或者为空 。如果目录不存在,则会自动创建该目录 。如果该目录为空,则根数据集会挂载在现有目录的顶层 。要使用不同的缺省挂载点创建池,请在 zpool create 命令中使用 -m 选项:
# zpool create home c1t0d0
default mountpoint "/home" exists and is not empty
use "-m" option to specify a different default
# zpool create -m /export/zfs home c1t0d0
# zpool create home c1t0d0
default mountpoint "/home" exists and is not empty
use "-m" option to provide a different default
# zpool create -m /export/zfs home c1t0d0

推荐阅读