Wednesday, June 24, 2015

How to grow aka extend ZFS datasets and Volumes?

ZFS Chapters:
1).How to Manage and Maintain ZFS file systems?
2).How to create ZFS file system and Volumes ?
3).How to set ZFS Dataset Properties on Solaris?

In ZFS we have two type of growing file system like dataset and volume .The ZFS dataset can be grow setting the quota and reservation properties.
Extend a volume is to setting the volsize property to new size and using growfs command to make new size take effect.When decrease volume size we need to be careful as we may loos our                                   data.
Extend / Grow ZFS dataset:
It is very simple then other file systems, just to set the properties to increase the dataset size.

Verify zpool has free space:
TID{root}# zfs list -r app_pool
NAME              USED  AVAIL  REFER  MOUNTPOINT
app_pool          500M  1.46G    32K  legacy
app_pool/applog    22K   500M    22K  /app_pool/applog
app_pool/sap       31K  1.46G    31K  /app_pool/sap
TID{root}#
Check current size for app_pool/applog dataset:
TID{root}# df -h /app_pool/applog
Filesystem             size   used  avail capacity  Mounted on
app_pool/applog        500M    22K   500M     1%    /app_pool/applog
TID{root}# zfs get quota app_pool/applog
NAME             PROPERTY  VALUE  SOURCE
app_pool/applog  quota     500M   local
TID{root}# zfs get reservation app_pool/applog
NAME             PROPERTY     VALUE   SOURCE
app_pool/applog  reservation  500M    local
TID{root}#
Growing size from 500MB to 1GB to app_pool/applog dataset:
Note:- Simply setting the "Quota" not guaranty that you will get 1GB, but you see you have 1GB space until other dataset used the free space from the pool, 
when you reserve the space then only it will be guaranty. So always set reservation if you want to use like a traditional file system.
TID{root}# zfs set quota=1g app_pool/applog
TID{root}# df -h /app_pool/applog
Filesystem             size   used  avail capacity  Mounted on
app_pool/applog        1.0G    22K   1.0G     1%    /app_pool/applog
TID{root}# zfs set reservation=1GB app_pool/applog
TID{root}# df -h /app_pool/applog
Filesystem             size   used  avail capacity  Mounted on
app_pool/applog        1.0G    22K   1.0G     1%    /app_pool/applog
TID{root}# zfs get reservation app_pool/applog
NAME             PROPERTY     VALUE   SOURCE
app_pool/applog  reservation  1G      local
TID{root}# zfs get quota app_pool/applog
NAME             PROPERTY  VALUE  SOURCE
app_pool/applog  quota     1G     local
TID{root}#
Extend / Grow ZFS Volume (zvol):
How to identify volumes under the pool?
For volumes only we will be seeing "volsize" properties, as we can't see same for datasets.
TID{root}# zfs list -r db_pool
NAME             USED  AVAIL  REFER  MOUNTPOINT
db_pool         2.32G  1.59G    32K  /db_pool
db_pool/oracle  1.81G  1.59G  1.81G  /db_pool/oracle
db_pool/oravol   516M  2.06G  30.1M  -
TID{root}# zfs get all db_pool/oravol | grep -i volsize
db_pool/oravol  volsize             500M                   local
TID{root}#
To identify volumes generally:
Only we can see "dsk" and "rdsk" under the "/dev/zvol/" if it is volume.
TID{root}# df -h /oravol
Filesystem             size   used  avail capacity  Mounted on
/dev/zvol/dsk/db_pool/oravol
                       470M   1.0M   422M     1%    /oravol
TID{root}# fstyp /dev/zvol/rdsk/db_pool/oravol
ufs
TID{root}#
Growing/Expanding a volume is simple to setting the "volsize" property to the new value and growfs to make the file system to take effect new size.
TID{root}# zfs get volsize db_pool/oravol
NAME            PROPERTY  VALUE    SOURCE
db_pool/oravol  volsize   500M     local
TID{root}# zfs set volsize=1GB db_pool/oravol
TID{root}# df -h /oravol
Filesystem             size   used  avail capacity  Mounted on
/dev/zvol/dsk/db_pool/oravol
                       470M   1.0M   422M     1%    /oravol
TID{root}# growfs -M /oravol /dev/zvol/rdsk/db_pool/oravol
Warning: 4130 sector(s) in last cylinder unallocated
/dev/zvol/rdsk/db_pool/oravol:  2097118 sectors in 342 cylinders of 48 tracks, 128 sectors
        1024.0MB in 25 cyl groups (14 c/g, 42.00MB/g, 20160 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 86176, 172320, 258464, 344608, 430752, 516896, 603040,689184,775328,
 1292192, 1378336, 1464480, 1550624, 1636768, 1722912, 1809056, 1895200,
 1981344, 2067488
TID{root}# df -h /oravol
Filesystem             size   used  avail capacity  Mounted on
/dev/zvol/dsk/db_pool/oravol
                       962M   1.0M   914M     1%    /oravol
TID{root}# zfs get volsize db_pool/oravol
NAME            PROPERTY  VALUE    SOURCE
db_pool/oravol  volsize   1G       local
TID{root}#
Cool... we have expanded volume successfully.

2 comments:

  1. Nice and good article.It will helpful for interview perspective.I have suggested to my friends to go through this blog. Thanks for sharing this useful information. If you want to learn Linux course in online, please visit below site.
    Linux online Training
    Linux online course
    Linux Online Training in Hyderabad
    Linux Online Training in Bangalore
    Linux Online Training in Chennai

    ReplyDelete
  2. MGM Grand Hotel & Casino - KSR Hub
    Information on the MGM 경기도 출장샵 Grand Hotel & Casino. Casino 성남 출장마사지 Resort is located in the heart of downtown Las Vegas. The casino offers everything  Rating: 논산 출장샵 4.7 · ‎8 reviews · 양주 출장마사지 ‎Price range: $$$How is MGM 문경 출장마사지 Grand Hotel & Casino rated?What days are MGM Grand Hotel & Casino open?

    ReplyDelete