Solaris zfs文件系统实例配置

简介:

zfs文件系统是solaris 10的重要特性,实例配置可以更容量的了解zfs文件系统配置。

 

一、Solaris磁盘基础 

1. 磁盘查看方法

# format 
AVAILABLE DISK SELECTIONS:
       0. c0d1 <xxx cyl 6524 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
       1. c1t0d0 <VMware,-VMwareVirtualS-1.0 cyl 1302 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@0,0
       2. c1t1d0 <VMware,-VMware Virtual S-1.0-10.00GB>
/pci@0,0/pci15ad,1976@10/sd@1,0
       3. c1t2d0 <VMware,-VMware Virtual -1.0  cyl 1303 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@2,0
       4. c1t3d0 <VMware,-VMware Virtual S-1.0-10.00GB>
/pci@0,0/pci15ad,1976@10/sd@3,0

Specify disk (enter its number): 3  
# quit 退出


2. 磁盘容量查看方法

# iostat -E


二、ZFS文件系统配置

1. 创建zpool(raid0)

创建名为first的zfs文件系统

# zpool create -f first c1t0d0 c1t1d0 c1t2d0

'first' successfully created, but with no redundancy; failure of one
device will cause loss of the pool

说明:
# 提示三块盘没有做冗余,坏一盘全坏。
# 加入pool的硬盘是整块盘,这样便于pool对硬盘的管理。
# 由于加入pool的磁盘之前曾经使用过ufs,所以在创建过程中需要使用-f选项来忽视ufs文件格式将硬盘强制加入pool中。 


对pool进行扩容

# zpool add first c1t3d0

-n 模拟扩容之后结果
-f 强制执行

# zpool add -n -f first c1t3d0
would update 'first' to the following configuration: 
       first
          c1t0d0
          c1t1d0
          c1t3d0


2. 创建镜像pool,通常两块盘一样大小容(raid1)
# zpool create -f first mirror c1t0d0 c1t1d0  

 

3. 创建mirror pool(raid 10)
# zpool create -f first mirror c1t0d0 c1t1d0 mirror c1t2d0 c1t3d0 

 

4. 创建raidz zpool (raid5)
# zpool create first raidz2 c1t0d0 c1t1d0 c1t2d0 c1t3d0 

 

5. 创建raidz zpool并加入一块热备盘
# zpool create first raidz2 c1t0d0 c1t1d0 c1t2d0 spare c1t3d0 

(1)热备盘的添加
# zpool add first spare c1t3d0 

(2)热备盘的删除
# zpool remove first c1t3d0

 

6. 镜像和拆镜像 

(1) 创建镜像 
如果创建zpool时,物理盘为单,可以对其进行镜像,命令格式为 
# zpool attach first 老的磁盘 新的磁盘

# zpool attach first c1t0d0 c1t1d0

(2) 拆分镜像(与境像过程相反,因为影响数据)
# zpool detach first c1t1d0 


7. 删除zpool 

# zpool destroy poolname 
# zpool destroy -f poolname 


8. 查看zpool列表,状态

# zpool list 
# zpool status [-x][-v]
# 校验的目的
# zpool scrub poolname 

# 校验的目的,这一般会花费很长的时间,
# zpool status 查看校验进度,最好在硬件出现问题,解决后都校验一次以保证一切正常。


9. 创建一个文件系统

 

经典使用示例

1) 创建u01文件系统
# zfs create first/u01

2) 挂载到/u01目录,不挂载也可以直接使用
# zfs set mountpoint=/u01 first/u01

3) 设置磁盘配额
# zfs set quota=20G first/u01

 

创建快照

1) 创建快照
# zfs snapshot first/u01@ok

2) 恢复快照
# zfs rollback first/u01@ok

3) 删除快照及ZFS文件系统

说明:删除u01的快照时,加-R参数连同源一起删除,慎用。
# zfs destroy -R  first/u01@ok


创建ZFS克隆:

通过快照创建zfs目录

# zfs clone first/u01@ok first/bak



本文转自 koumm 51CTO博客,原文链接:http://blog.51cto.com/koumm/1250917,如需转载请自行联系原作者



相关文章
|
8月前
|
数据管理 Linux
8.4.2 【Linux】XFS 文件系统还原 xfsrestore
8.4.2 【Linux】XFS 文件系统还原 xfsrestore
73 0
|
8月前
|
Linux Windows
7.1.8 其他Linux支持的文件系统与VFS
7.1.8 其他Linux支持的文件系统与VFS
48 0
|
10月前
|
Linux
linux基础-磁盘挂载
磁盘管理 查看挂载情况 lsblk -f 挂载步骤 1.虚拟机增加硬盘 2.分区命令 fdisk /dev(设备文件)/sdb m 显示命令列表 p 显示磁盘分区 n 新增分区 d 删除分区 w 写入并退出 3.格式化磁盘,并挂载 mkfs -t ext4 /dev/sdb1 mount /dev/sdb1 文件路径
56 0
|
固态存储 Linux
Linux下正确挂载Raid分区
Linux下正确挂载Raid分区
Linux下正确挂载Raid分区
|
Linux Ubuntu Windows