ZFS: Verify/change properties of a zfs filesystem

ZFS: Verify/change properties of a zfs filesystem

# Tested on RHEL 6 & 7


ZPOOL=c_pool
ZFSFS=zfs01

# Check the properties of the filesystem

zfs get all $ZPOOL/$ZFSFS
   NAME          PROPERTY              VALUE                  SOURCE
   c_pool/zfs01  type                  filesystem             -
   c_pool/zfs01  creation              Wed Sep  2 12:36 2015  -
   c_pool/zfs01  used                  349M                   -
   c_pool/zfs01  available             675M                   -
   c_pool/zfs01  referenced            349M                   -
   c_pool/zfs01  compressratio         28.18x                 -
   c_pool/zfs01  mounted               yes                    -
   c_pool/zfs01  quota                 1G                     local
   c_pool/zfs01  reservation           none                   default
   c_pool/zfs01  recordsize            128K                   default
   c_pool/zfs01  mountpoint            /zfs01                 local
   c_pool/zfs01  sharenfs              on                     local
   c_pool/zfs01  checksum              on                     default
   c_pool/zfs01  compression           on                     local
   c_pool/zfs01  atime                 on                     default
   c_pool/zfs01  devices               on                     default
   c_pool/zfs01  exec                  on                     default
   c_pool/zfs01  setuid                on                     default
   c_pool/zfs01  readonly              off                    default
   c_pool/zfs01  zoned                 off                    default
   c_pool/zfs01  snapdir               hidden                 default
   c_pool/zfs01  aclinherit            restricted             default
   c_pool/zfs01  canmount              on                     default
   c_pool/zfs01  xattr                 on                     default
   c_pool/zfs01  copies                1                      default
   c_pool/zfs01  version               5                      -
   c_pool/zfs01  utf8only              off                    -
   c_pool/zfs01  normalization         none                   -
   c_pool/zfs01  casesensitivity       sensitive              -
   c_pool/zfs01  vscan                 off                    default
   c_pool/zfs01  nbmand                off                    default
   c_pool/zfs01  sharesmb              off                    default
   c_pool/zfs01  refquota              none                   default
   c_pool/zfs01  refreservation        none                   default
   c_pool/zfs01  primarycache          all                    default
   c_pool/zfs01  secondarycache        all                    default
   c_pool/zfs01  usedbysnapshots       0                      -
   c_pool/zfs01  usedbydataset         349M                   -
   c_pool/zfs01  usedbychildren        0                      -
   c_pool/zfs01  usedbyrefreservation  0                      -
   c_pool/zfs01  logbias               latency                default
   c_pool/zfs01  dedup                 off                    default
   c_pool/zfs01  mlslabel              none                   default
   c_pool/zfs01  sync                  standard               default
   c_pool/zfs01  refcompressratio      28.18x                 -



# Get one the properties (in this case, see if F.S. is NFS shareable)

zfs get sharenfs $ZPOOL/$ZFSFS
   NAME          PROPERTY  VALUE     SOURCE
   c_pool/zfs01  sharenfs  on        local


zfs get all $ZPOOL/$ZFSFS | grep sharenfs
   c_pool/zfs01  sharenfs              on                     local



# Change one of the properties (in this case, we make the F.S. not shareable)

zfs set sharenfs=off $ZPOOL/$ZFSFS



# Regarding the "sharenfs" property, we can make all zfs filesystems that have the property
# "on", automatically being exported. It persists over a reboot. We can run individual
# "zfs share" commands for specific filesystems (for this to work, obviously, nfs service
# must be started):
#
# zfs set sharenfs=on $ZPOOL/$ZFSFS
#
# zfs share -a    # or "zfs share $ZPOOL/$ZFSFS"
#
# showmount -e
#    Export list for <myserver>:
#    /zfs01 *



# Change F.S. mount point (obviously to carry out this operation F.S. shouldn't be in use)

MNTPT=newmnpt

zfs set mountpoint=/$MNTPT $ZPOOL/$ZFSFS

zfs list | grep $ZPOOL/$ZFSFS
   c_pool/zfs01   349M   675M   349M  /newmnpt

zfs mount $ZPOOL/$ZFSFS    # alternatively run "zfs mount -a"

df -h /$MNTPT
   Filesystem            Size  Used Avail Use% Mounted on
   c_pool/zfs01          1.0G  350M  675M  35% /newmnpt
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Linux / UNIX: Run Command a Number of Times In a Row
Viewed 15811 times since Tue, Aug 6, 2019
systemctl Use systemd to Start a Linux Service at Boot
Viewed 5658 times since Mon, Dec 7, 2020
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 6671 times since Fri, Sep 28, 2018
Linux RedHat How To Create An RPM Package
Viewed 3113 times since Sun, Jan 9, 2022
OpenSSL: Check If Private Key Matches SSL Certificate & CSR
Viewed 3009 times since Mon, Feb 18, 2019
RHCS6: Extend an existing Logical Volume / GFS2 filesystem
Viewed 3140 times since Sun, Jun 3, 2018
stunnel Howto A Guide to create SSL access to a HTTP-only webserver with stunnel
Viewed 2591 times since Fri, Sep 28, 2018
Linux: Disks diagnostic using smartctl
Viewed 14763 times since Wed, Jul 25, 2018
Index » Community Contributions » System encryption using LUKS and GPG encrypted keys for arch linux
Viewed 3031 times since Fri, Jul 13, 2018
RHEL: Forgotten ’root’ password / using single-user to gain access
Viewed 7258 times since Sat, Jun 2, 2018