In this short Blog I will show how you can create a new ZFS pool, file system and also show some other ZFS command on OEL7.
ZFS installation on OEL7
# yum install -y yum-utils
# yum-config-manager --enable ol7_developer_EPEL
# yum install -y dkms
# rpm -Uvh http://download.zfsonlinux.org/epel/zfs-release.el7_6.noarch.rpm
# sudo yum install -y zfs
# /sbin/modprobe zfs
# systemctl -a | grep zfs
Identify device(s)
[root@localhost ~]# fdisk -l
...
Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
...
Show Status
Confirm status, as you can see we currently have no ZFS pools defined.
[root@localhost ~]# zpool list
no pools available
[root@localhost ~]# zfs list
no datasets available
Create a ZFS pool
The zpool create command will by default automatically mount the pool using the same name, however you can specify a different location with the -m option. In this example I am assuming the data protection is being provided by the storage sub-system so have not specified any RAID configuration.
[root@localhost ~]# zpool create mypool /dev/sdc
[root@localhost ~]# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
mypool 9.94G 106K 9.94G - 0% 0% 1.00x ONLINE -
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
mypool 9.7G 0 9.7G 0% /mypool
Enable autoexpand on ZFS pool
[root@localhost ~]# zpool get autoexpand mypool
NAME PROPERTY VALUE SOURCE
mypool autoexpand off default
[root@localhost ~]# zpool set autoexpand=on mypool
[root@localhost ~]# zpool get autoexpand mypool
NAME PROPERTY VALUE SOURCE
mypool autoexpand on local
Show ZFS zpool status
[root@localhost ~]# zpool status
pool: mypool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
mypool ONLINE 0 0 0
sdc ONLINE 0 0 0
errors: No known data errors
Create ZFS File System
[root@localhost ~]# zfs create mypool/myfs
[root@localhost ~]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mypool 116K 9.63G 25.5K /mypool
mypool/myfs 24K 9.63G 24K /mypool/myfs
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
mypool 9.7G 0 9.7G 0% /mypool
mypool/myfs 9.7G 0 9.7G 0% /mypool/myfs
Check status of compression and dedup
[root@localhost ~]# zfs get -r compression mypool/myfs
NAME PROPERTY VALUE SOURCE
mypool/myfs compression off default
[root@localhost ~]# zfs get -r dedup mypool/myfs
NAME PROPERTY VALUE SOURCE
mypool/myfs dedup off default
Finally, mount status
[root@localhost mypool]# mount
..
mypool on /mypool type zfs (rw,seclabel,xattr,noacl)
mypool/myfs on /mypool/myfs type zfs (rw,seclabel,xattr,noacl)
[twitter-follow screen_name=’RonEkins’ show_count=’yes’]
Leave a Reply