当前位置: > CentOS > CentOS教程 >

CentOS6.2安装ZFS文件系统组RAID-Z使用SSD缓存

时间:2016-12-18 09:48来源:linux.it.net.cn 作者:IT

CentOS服务器安装编译环境及相应组件:

1
2
yum groupinstall "Development Tools"
yum install kernel-devel zlib-devel libuuid-devel libblkid-devel libselinux-devel parted lsscsi nano mdadm bc

安装ZFS内核模块:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
wget http://github.com/downloads/zfsonlinux/spl/spl-0.6.0-rc10.tar.gz
wget http://github.com/downloads/zfsonlinux/zfs/zfs-0.6.0-rc10.tar.gz
tar xvzpf spl-0.6.0-rc10.tar.gz
tar xvzpf zfs-0.6.0-rc10.tar.gz
cd spl-0.6.0-rc10
./configure
make rpm
rpm -Uvh *.x86_64.rpm
cd ..
cd zfs-0.6.0-rc10
./configure
make rpm
rpm -Uvh *.x86_64.rpm
cd ..

加载ZFS模块:

1
modprobe zfs

查看当前硬盘分区,四块1T硬盘准备组成RAID-Z。

1
2
3
4
5
6
[root ~]# fdisk -l | grep GB
Disk /dev/sde: 120.0 GB, 120034123776 bytes
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes

新建ZFS池并组成RAID:

1
zpool create www.haiyun.me raidz -f sda sdb sdc sdd

开机挂载新建ZFS池:

1
echo "zfs mount www.haiyun.me" >> /etc/rc.local

查看SSD硬盘分区信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fdisk -l /dev/sde
 
Disk /dev/sde: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002824e
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sde2              26        2115    16777216   8e  Linux LVM
/dev/sde3            2115        2376     2097152   82  Linux swap / Solaris
/dev/sde4            2376       14594    98140632    5  Extended
/dev/sde5            2376       14594    98139136   83  Linux

SSD分区/dev/sde2设置为ZFS缓存:

1
zpool add www.haiyun.me cache sde2

查看ZFS状态:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
zpool status
  pool: storage
 state: ONLINE
 scan: none requested
config:
 
    NAME        STATE     READ WRITE CKSUM
    storage     ONLINE       0     0     0
      raidz1-0  ONLINE       0     0     0
        sda     ONLINE       0     0     0
        sdb     ONLINE       0     0     0
        sdc     ONLINE       0     0     0
        sdd     ONLINE       0     0     0
    cache
      sde2      ONLINE       0     0     0

ZFS设置优化其它参数:

1
2
3
zfs set compression=on storage
zfs set dedup=on storage
zfs set atime=off storage

其它使用SSD缓存可参考:CentOS安装FlashCache使用SSD缓存。




(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容