ZFS 设置指南
翻译自2010年3月http://www.solarisinternals.com/wiki/index.php/ZFS_Configuration_Guide
翻译者:上海锋群网络技术有限公司 徐鹤军
-
2 如何在SUN x4500设备上设置ZFS
-
2.1 ZFS 实例配置(raidz2功能用于x4500系统)
-
2.2 ZFS 实例配置(镜像功能用于x4500系统)
-
ZFS 实例设置(raidz2功能用于x4500系统)
在本例中,磁盘如下配置:
-
SXCE and Solaris 10 releases, c4t0d0 and c5t0d0 can be a mirrored ZFS root pool for bootable ZFS dataset and dump and swap devices
-
对于SXCE和Solaris 10 版本,c4t0d0和c5t0d0能被镜像成ZFS的根pool用于可启动的ZFS数据集和dump和swap设备。
-
一个ZFS根pool必须被创建在片区上才能启动。例如,等效的zpool 创建语法是:
zpool create mpool mirror c4t0d0s0 c5t0d0s0
-
ZFS 存储pool包含7个RAIDz2设备,每个设备又由6个磁盘组成。
-
这个RAIDz2设置提供了大致12.5TB的文件空间。
-
c0t0d0,c1t0d0,c6t0d0 和c7t0d0被作为热备盘。
在接下来的实例中,这rzpool存储pool由4个RAIDz2设备创建,每个设备又由6个磁盘组成。依赖于你的shell环境,你可能陷入单行中最多数量字符的限制,所以本指令被分割成不同的几步。
首先,创建4个RAIDz2的设备,每个设备又有6个磁盘。
# zpool create rzpool raidz2 c0t1d0 c1t1d0 c4t1d0 c5t1d0 c6t1d0 c7t1d0 raidz2 c0t2d0 c1t2d0 c4t2d0 c5t2d0 c6t2d0 c7t2d0 raidz2 c0t3d0 c1t3d0 c4t3d0 c5t3d0 c6t3d0 c7t3d0 raidz2 c0t4d0 c1t4d0 c4t4d0 c5t4d0 c6t4d0 c7t4d0 # zpool status pool: rpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t1d0 ONLINE 0 0 0 c1t1d0 ONLINE 0 0 0 c4t1d0 ONLINE 0 0 0 c5t1d0 ONLINE 0 0 0 c6t1d0 ONLINE 0 0 0 c7t1d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t2d0 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 c4t2d0 ONLINE 0 0 0 c5t2d0 ONLINE 0 0 0 c6t2d0 ONLINE 0 0 0 c7t2d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t3d0 ONLINE 0 0 0 c1t3d0 ONLINE 0 0 0 c4t3d0 ONLINE 0 0 0 c5t3d0 ONLINE 0 0 0 c6t3d0 ONLINE 0 0 0 c7t3d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t4d0 ONLINE 0 0 0 c1t4d0 ONLINE 0 0 0 c4t4d0 ONLINE 0 0 0 c5t4d0 ONLINE 0 0 0 c6t4d0 ONLINE 0 0 0 c7t4d0 ONLINE 0 0 0 errors: No known data errors
接着,增加另外3个拥有6个磁盘构成的RAIDz2设备,以及4个热备盘。
# zpool add rzpool raidz2 c0t5d0 c1t5d0 c4t5d0 c5t5d0 c6t5d0 c7t5d0 # zpool add rzpool raidz2 c0t6d0 c1t6d0 c4t6d0 c5t6d0 c6t6d0 c7t6d0 # zpool add rzpool raidz2 c0t7d0 c1t7d0 c4t7d0 c5t7d0 c6t7d0 c7t7d0 # zpool add rzpool spare c0t0d0 c1t0d0 c6t0d0 c7t0d0
检查一下这个pool的配置。
# zpool status pool: rzpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM rzpool ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t1d0 ONLINE 0 0 0 c1t1d0 ONLINE 0 0 0 c4t1d0 ONLINE 0 0 0 c5t1d0 ONLINE 0 0 0 c6t1d0 ONLINE 0 0 0 c7t1d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t2d0 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 c4t2d0 ONLINE 0 0 0 c5t2d0 ONLINE 0 0 0 c6t2d0 ONLINE 0 0 0 c7t2d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t3d0 ONLINE 0 0 0 c1t3d0 ONLINE 0 0 0 c4t3d0 ONLINE 0 0 0 c5t3d0 ONLINE 0 0 0 c6t3d0 ONLINE 0 0 0 c7t3d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t4d0 ONLINE 0 0 0 c1t4d0 ONLINE 0 0 0 c4t4d0 ONLINE 0 0 0 c5t4d0 ONLINE 0 0 0 c6t4d0 ONLINE 0 0 0 c7t4d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t5d0 ONLINE 0 0 0 c1t5d0 ONLINE 0 0 0 c4t5d0 ONLINE 0 0 0 c5t5d0 ONLINE 0 0 0 c6t5d0 ONLINE 0 0 0 c7t5d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t6d0 ONLINE 0 0 0 c1t6d0 ONLINE 0 0 0 c4t6d0 ONLINE 0 0 0 c5t6d0 ONLINE 0 0 0 c6t6d0 ONLINE 0 0 0 c7t6d0 ONLINE 0 0 0 raidz2 ONLINE 0 0 0 c0t7d0 ONLINE 0 0 0 c1t7d0 ONLINE 0 0 0 c4t7d0 ONLINE 0 0 0 c5t7d0 ONLINE 0 0 0 c6t7d0 ONLINE 0 0 0 c7t7d0 ONLINE 0 0 0 spares c0t0d0 AVAIL c1t0d0 AVAIL c6t0d0 AVAIL c7t0d0 AVAIL errors: No known data errors
识别一下有效的pool容量和文件系统的空间。
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT rzpool 19.0T 238K 19.0T 0% ONLINE - # zfs list NAME USED AVAIL REFER MOUNTPOINT rzpool 151K 12.5T 49.0K /rpool
创建所需的文件系统,例如:
# zfs create rzpool/users # zfs create rzpool/devs # zfs create rzpool/data # zfs list NAME USED AVAIL REFER MOUNTPOINT rzpool 331K 12.5T 54.9K /rzpool rzpool/data 49.0K 12.5T 49.0K /rzpool/data rzpool/devs 49.0K 12.5T 49.0K /rzpool/devs rzpool/users 49.0K 12.5T 49.0K /rzpool/users
ZFS 实例设置(镜像功能用于x4500系统)
在本例中,磁盘如下设置:
-
对于SXCE和Solaris 10 版本,c4t0d0和c5t0d0能被镜像成ZFS的根pool用于可启动的ZFS数据集和dump和swap设备。
-
在初始安装或者是定制的JumpStart安装过程中创建镜像的ZFS根pool。
与之等效的zpool 创建语法是,例如:
zpool create rpool mirror c5t0d0s0 c4t0d0s0
ZFS存储pool包含14个3路镜像
-
c0t0d0,c1t0d0,c6t0d0和c7t0d0都被用于ZFS 的热备盘。
-
这个镜像的ZFS 配置提供了大致6.24TB的文件系统空间。
在接下来的实例中,在由起先3个控制器上的7个3路镜像上创建了这个mpool存储pool。
# zpool create mpool mirror c0t1d0 c1t1d0 c4t1d0 mirror c0t2d0 c1t2d0 c4t2d0 mirror c0t3d0 c1t3d0 c4t3d0 mirror c0t4d0 c1t4d0 c4t4d0 mirror c0t5d0 c1t5d0 c4t5d0 mirror c0t6d0 c1t6d0 c4t6d0 mirror c0t7d0 c1t7d0 c4t7d0
检查一下这个pool的设置。
# zpool status pool: mpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM mpool ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t1d0 ONLINE 0 0 0 c1t1d0 ONLINE 0 0 0 c4t1d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t2d0 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 c4t2d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t3d0 ONLINE 0 0 0 c1t3d0 ONLINE 0 0 0 c4t3d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t4d0 ONLINE 0 0 0 c1t4d0 ONLINE 0 0 0 c4t4d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t5d0 ONLINE 0 0 0 c1t5d0 ONLINE 0 0 0 c4t5d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t6d0 ONLINE 0 0 0 c1t6d0 ONLINE 0 0 0 c4t6d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t7d0 ONLINE 0 0 0 c1t7d0 ONLINE 0 0 0 c4t7d0 ONLINE 0 0 0 errors: No known data errors
接着,添加剩下的7个镜像和4个热备盘。
# zpool add mpool mirror c5t1d0 c6t1d0 c7t1d0 # zpool add mpool mirror c5t2d0 c6t2d0 c7t2d0 # zpool add mpool mirror c5t3d0 c6t3d0 c7t3d0 # zpool add mpool mirror c5t4d0 c6t4d0 c7t4d0 # zpool add mpool mirror c5t5d0 c6t5d0 c7t5d0 # zpool add mpool mirror c5t6d0 c6t6d0 c7t6d0 # zpool add mpool mirror c5t7d0 c6t7d0 c7t7d0 # zpool add mpool spare c0t0d0 c1t0d0 c6t0d0 c7t0d0
检查一下这个pool的设置。
# zpool status pool: mpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM mpool ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t1d0 ONLINE 0 0 0 c1t1d0 ONLINE 0 0 0 c4t1d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t2d0 ONLINE 0 0 0 c1t2d0 ONLINE 0 0 0 c4t2d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t3d0 ONLINE 0 0 0 c1t3d0 ONLINE 0 0 0 c4t3d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t4d0 ONLINE 0 0 0 c1t4d0 ONLINE 0 0 0 c4t4d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t5d0 ONLINE 0 0 0 c1t5d0 ONLINE 0 0 0 c4t5d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t6d0 ONLINE 0 0 0 c1t6d0 ONLINE 0 0 0 c4t6d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c0t7d0 ONLINE 0 0 0 c1t7d0 ONLINE 0 0 0 c4t7d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t1d0 ONLINE 0 0 0 c6t1d0 ONLINE 0 0 0 c7t1d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t2d0 ONLINE 0 0 0 c6t2d0 ONLINE 0 0 0 c7t2d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t3d0 ONLINE 0 0 0 c6t3d0 ONLINE 0 0 0 c7t3d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t4d0 ONLINE 0 0 0 c6t4d0 ONLINE 0 0 0 c7t4d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t5d0 ONLINE 0 0 0 c6t5d0 ONLINE 0 0 0 c7t5d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t6d0 ONLINE 0 0 0 c6t6d0 ONLINE 0 0 0 c7t6d0 ONLINE 0 0 0 mirror ONLINE 0 0 0 c5t7d0 ONLINE 0 0 0 c6t7d0 ONLINE 0 0 0 c7t7d0 ONLINE 0 0 0 spares c0t0d0 AVAIL c1t0d0 AVAIL c6t0d0 AVAIL c7t0d0 AVAIL errors: No known data errors
识别有效的pool容量和文件系统空间。
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT mpool 6.34T 125K 6.34T 0% ONLINE - # zfs list NAME USED AVAIL REFER MOUNTPOINT mpool 118K 6.24T 24.5K /mpool
创建所需的文件系统,例如:
# zfs create mpool/users # zfs create mpool/devs # zfs create mpool/data # zfs list NAME USED AVAIL REFER MOUNTPOINT mpool 208K 6.24T 28.5K /mpool mpool/data 24.5K 6.24T 24.5K /mpool/data mpool/devs 24.5K 6.24T 24.5K /mpool/devs mpool/users 24.5K 6.24T 24.5K /mpool/users