zfs 安装以及使用

安装
$ sudo yum localinstall --nogpgcheck http://archive.zfsonlinux.org/epel/zfs-release$(rpm -E %dist).noarch.rpm
$ sudo yum install zfs
安装比较简单

下面介绍创建zpool,以及如何使用

# fdisk -l

Disk /dev/sda: 146.2 GB, 146163105792 bytes
255 heads, 63 sectors/track, 17769 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: 0x00000080

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        4178    33554432   83  Linux
/dev/sda2            4178        5222     8388608   82  Linux swap / Solaris
/dev/sda3            5222       17769   100785428+  83  Linux

Disk /dev/sdb: 999.7 GB, 999653638144 bytes
255 heads, 63 sectors/track, 121534 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: 0x00000000
查看磁盘以及分区:
# cd /dev/disk/by-id/
# ll
total 0
lrwxrwxrwx 1 root root  9 Aug 25 14:22 scsi-36842b2b009a76d0014f5ff710812855d -> ../../sda
lrwxrwxrwx 1 root root 10 Aug 25 14:22 scsi-36842b2b009a76d0014f5ff710812855d-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Aug 25 14:22 scsi-36842b2b009a76d0014f5ff710812855d-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Aug 25 14:23 scsi-36842b2b009a76d0014f5ff710812855d-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Aug 25 14:30 scsi-36842b2b009a76d001c22fa883ebdcf7f -> ../../sdb
lrwxrwxrwx 1 root root  9 Aug 25 14:22 usb-iDRAC_LCDRIVE_20080519-0:0 -> ../../sdc
lrwxrwxrwx 1 root root  9 Aug 25 14:22 usb-iDRAC_Virtual_CD_20080519-0:0 -> ../../sr0
lrwxrwxrwx 1 root root  9 Aug 25 14:22 usb-iDRAC_Virtual_Floppy_20080519-0:1 -> ../../sdd
lrwxrwxrwx 1 root root  9 Aug 25 14:22 wwn-0x6842b2b009a76d0014f5ff710812855d -> ../../sda
lrwxrwxrwx 1 root root 10 Aug 25 14:22 wwn-0x6842b2b009a76d0014f5ff710812855d-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Aug 25 14:22 wwn-0x6842b2b009a76d0014f5ff710812855d-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Aug 25 14:23 wwn-0x6842b2b009a76d0014f5ff710812855d-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Aug 25 14:30 wwn-0x6842b2b009a76d001c22fa883ebdcf7f -> ../../sdb
创建zp1
# zpool create zp1 wwn-0x6842b2b009a76d0014f5ff710812855d-part3 wwn-0x6842b2b009a76d001c22fa883ebdcf7f
# zpool status zp1
  pool: zp1
 state: ONLINE
  scan: none requested
config:

        NAME                                            STATE     READ WRITE CKSUM
        zp1                                             ONLINE       0     0     0
          wwn-0x6842b2b009a76d0014f5ff710812855d-part3  ONLINE       0     0     0 
          wwn-0x6842b2b009a76d001c22fa883ebdcf7f        ONLINE       0     0     0

创建zfs文件系统并开启压缩
# zfs create -o mountpoint=/data01 zp1/data01        #创建文件系统并挂载到对应的目录      
# zfs create -o mountpoint=/data02 zp1/data02
# zfs set compression=gzip zp1/data01                #开启gzip压缩
# zfs set compression=gzip zp1/data02
# zfs get -r compression zp1                         #查看zp1压缩是否开启
# zfs set canmount=off zp1                           #关闭自身zp1目录的挂载

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        32G  3.4G   27G  12% /
tmpfs            12G     0   12G   0% /dev/shm
zp1/data01     1008G     0 1008G   0% /data01
zp1/data02     1008G     0 1008G   0% /data02

你可能感兴趣的:(zfs 安装以及使用)