ZFS: Grow/Shrink an existing zfs filesystem

ZFS: Grow/Shrink an existing zfs filesystem

# Tested on RHEL 6 & 7


# Choose the F.S. to resize and verify current size

zfs list
   NAME           USED  AVAIL  REFER  MOUNTPOINT
   c_pool         204K  19.6G    30K  /c_pool
   c_pool/zfs01    30K  1024M    30K  /zfs01
   c_pool/zfs02    30K  19.6G    30K  /filesystem02
   m_pool         100K  9.78G    30K  /m_pool


ZPOOL=c_pool
ZFS=zfs01


df -h /$ZFS
   Filesystem            Size  Used Avail Use% Mounted on
   c_pool/zfs01          1.0G  128K  1.0G   1% /zfs01



# Extend F.S. to 2GB

zfs set quota=2g $ZPOOL/$ZFS



# Check

zfs list
   NAME           USED  AVAIL  REFER  MOUNTPOINT
   c_pool         204K  19.6G    30K  /c_pool
   c_pool/zfs01    30K  2.00G    30K  /zfs01
   c_pool/zfs02    30K  19.6G    30K  /filesystem02
   m_pool         100K  9.78G    30K  /m_pool


df -h /$ZFS
   Filesystem            Size  Used Avail Use% Mounted on
   c_pool/zfs01          2.0G  128K  2.0G   1% /zfs01



# Reduce F.S. back to 1GB

zfs set quota=1g $ZPOOL/$ZFS



# Check

zfs list
   NAME           USED  AVAIL  REFER  MOUNTPOINT
   c_pool         204K  19.6G    30K  /c_pool
   c_pool/zfs01    30K  1024M    30K  /zfs01
   c_pool/zfs02    30K  19.6G    30K  /filesystem02
   m_pool         100K  9.78G    30K  /m_pool



df -h /$ZFS
   Filesystem            Size  Used Avail Use% Mounted on
   c_pool/zfs01          1.0G  128K  1.0G   1% /zfs01



# Here is what happens if we fill up a little bit our filesystem and then try to reduce it
# below the boundary of used space

df -h /$ZFS
   Filesystem            Size  Used Avail Use% Mounted on
   c_pool/zfs01          1.0G  350M  675M  35% /zfs01


zfs set quota=256m $ZPOOL/$ZFS
   cannot set property for 'c_pool/zfs01': size is less than current used or reserved space
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
RHEL: Services basic management - chkconfig
Viewed 5489 times since Sat, Jun 2, 2018
RHEL: Extending the maximum inode count on a ext2/ext3/ext4 filesystem
Viewed 3072 times since Sun, May 27, 2018
tcpdump
Viewed 8994 times since Fri, Jul 27, 2018
RHCS6: Luci - the cluster management console
Viewed 3117 times since Sun, Jun 3, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 20161 times since Fri, Aug 3, 2018
How to maximise SSD performance with Linux
Viewed 8549 times since Fri, May 15, 2020
Installing and Configuring stunnel on CentOS 6
Viewed 4004 times since Fri, Sep 28, 2018
Linux - How to shutdown or reboot
Viewed 2056 times since Fri, Jun 8, 2018
Fix rpmdb: Thread died in Berkeley DB library
Viewed 20962 times since Fri, Feb 14, 2020
What is yum-cron ?
Viewed 2603 times since Fri, Oct 26, 2018