ZFS Chapters:
1). How to create ZFS file system and Volumes
In commonly ZFS has many parameter and properties to use ZFS dataset and file systems effectively.Also vendor oracle recommending to use some set of properties to get good performance for particularly DB file systems and datasets.
Mostly we will be in the situation to set quota, reservation, dedicated mountpoint, etc...
We will see some of the most common properties which generally we use in ZFS environment.
To list all the properties for particular pool "app_pool":
Colored properties are need to change according to the client environment and vendor recommendation.
You can refer man page for zfs to know the more detailed about each properties purpose.
1). How to create ZFS file system and Volumes
In commonly ZFS has many parameter and properties to use ZFS dataset and file systems effectively.Also vendor oracle recommending to use some set of properties to get good performance for particularly DB file systems and datasets.
Mostly we will be in the situation to set quota, reservation, dedicated mountpoint, etc...
We will see some of the most common properties which generally we use in ZFS environment.
To list all the properties for particular pool "app_pool":
Colored properties are need to change according to the client environment and vendor recommendation.
You can refer man page for zfs to know the more detailed about each properties purpose.
TID{root}# zfs get all app_pool
NAME PROPERTY VALUE SOURCE
app_pool type filesystem -
app_pool creation Tue Jun 9 23:11 2015 -
app_pool used 500M -
app_pool available 1.46G -
app_pool referenced 35K -
app_pool compressratio 1.00x -
app_pool mounted yes -
app_pool quota none default
app_pool reservation none default
app_pool recordsize 128K default
app_pool mountpoint /app_pool default
app_pool sharenfs off default
app_pool checksum on default
app_pool compression off default
app_pool atime on default
app_pool devices on default
app_pool exec on default
app_pool setuid on default
app_pool readonly off default
app_pool zoned off default
app_pool snapdir hidden default
app_pool aclinherit restricted default
app_pool canmount on default
app_pool shareiscsi off default
app_pool xattr on default
app_pool copies 1 default
app_pool version 5 -
app_pool utf8only off -
app_pool normalization none -
app_pool casesensitivity sensitive -
app_pool vscan off default
app_pool nbmand off default
app_pool sharesmb off default
app_pool refquota none default
app_pool refreservation none default
app_pool primarycache all default
app_pool secondarycache all default
app_pool usedbysnapshots 0 -
app_pool usedbydataset 35K -
app_pool usedbychildren 500M -
app_pool usedbyrefreservation 0 -
app_pool logbias latency default
app_pool sync standard default
app_pool rstchown on default
TID{root}#
How to set quota to ZFS dataset ?Quota is used to limit the amount of space consumed by a particular dataset,
it can't consume more than quota limit which is already set to this.
To set quota to particular dataset:
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 500M 1.46G 35K /app_pool
app_pool/sap 31K 1.46G 31K /app_pool/sap
app_pool/sapdata 31K 1.46G 31K /app_pool/sapdata
app_pool/saplog 500M 1.46G 500M /app_pool/saplog
app_pool/saporg 31K 1.46G 31K /app_pool/saporg
TID{root}# zfs get quota app_pool/sap
NAME PROPERTY VALUE SOURCE
app_pool/sap quota none default
TID{root}# zfs set quota=500m app_pool/sap
TID{root}# zfs get quota app_pool/sap
NAME PROPERTY VALUE SOURCE
app_pool/sap quota 500M local
TID{root}#
In the above we can see we have 1.46 GB space but we can't use more then 500MB for "app_pool/sap" dataset as we have set quota to limit the usage size.
TID{root}# mkfile 501m /app_pool/sap/appsfile.txt
/app_pool/sap/appsfile.txt: initialized 524156928 of 525336576 bytes:Discquota exceeded
TID{root}# ls -ltr /app_pool/sap/appsfile.txt
-rw------- 1 root root 525336576 Jun 10 19:41 /app_pool/sap/appsfile.txt
TID{root}# du -sh /app_pool/sap/appsfile.txt
500M /app_pool/sap/appsfile.txt
TID{root}# rm /app_pool/sap/appsfile.txt
TID{root}# mkfile 200m /app_pool/sap/dbfile.txt
TID{root}# du -sh /app_pool/sap/dbfile.txt
200M /app_pool/sap/dbfile.txt
TID{root}#
The above output shows that we were not able to create file call "appsfile.txt" more then 500MB so it showed error and created file with 500MB size. 2nd when I create 200MB file it was not shown any error and it got created successfully.
Also we can set quota to all the dataset but the usage size not guarantee that will get quota size limit until other dataset used. This is how quota is working.
e.g - I have set quota to all the dataset but if any of the one or multiple dataset are consumed 999 MB then other can't get the space. In this case we need to go for reservation, will see how reservation is coming into the picture and working.
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 1001M 999M 35K /app_pool
app_pool/sap 500M 0 500M /app_pool/sap
app_pool/sapdata 31K 999M 31K /app_pool/sapdata
app_pool/saplog 500M 999M 500M /app_pool/saplog
app_pool/saporg 31K 999M 31K /app_pool/saporg
TID{root}# zfs set quota=999m app_pool/sapdata
TID{root}# zfs set quota=999m app_pool/saplog
TID{root}# zfs set quota=999m app_pool/saporg
TID{root}# mkfile 999m app_pool/saporg/test.txt
app_pool/saporg/test.txt: initialized 1047265280 of 1047527424 bytes:Discquota exceeded
TID{root}# du -sh app_pool/saporg/test.txt
999M app_pool/saporg/test.txt
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 1.95G 101K 35K /app_pool
app_pool/sap 500M 0 500M /app_pool/sap
app_pool/sapdata 31K 101K 31K /app_pool/sapdata
app_pool/saplog 500M 101K 500M /app_pool/saplog
app_pool/saporg 999M 0 999M /app_pool/saporg
TID{root}# mkfile 5m app_pool/saporg/oralog.txt
Could not open app_pool/saporg/oralog.txt: Disc quota exceeded
TID{root}#
Above there is no available space as "app_pool/saporg/" dataset consumed all the available space and other dataset can't usage any more.I am trying to create 5MB files on other dataset "app_pool/saporg/oralog.txt" but could not.
How to set reservation ?
Reservations is to provide space guarantee that a dataset can consume a specified space from Zpool storage and total available free space will be reduced from the pool.
Setting reservation to dataset:
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 752K 1.95G 35K /app_pool
app_pool/sap 31K 1.95G 31K /app_pool/sap
app_pool/sapdata 31K 1.95G 31K /app_pool/sapdata
app_pool/saplog 31K 1.95G 31K /app_pool/saplog
app_pool/saporg 40K 1.95G 40K /app_pool/saporg
TID{root}# zfs set reservation=1.5G app_pool/saporg
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 1.50G 463M 35K /app_pool
app_pool/sap 31K 463M 31K /app_pool/sap
app_pool/sapdata 31K 463M 31K /app_pool/sapdata
app_pool/saplog 31K 463M 31K /app_pool/saplog
app_pool/saporg 40K 1.95G 40K /app_pool/saporg
TID{root}#
After set reservation the actual used size got increased and available free size reduced above.Creating one file to non-reserved dataset:
TID{root}# mkfile 500M /app_pool/sap/log.sap /app_pool/sap/log.sap: initialized 485621760 of 524288000 bytes: No space left on device TID{root}# du -sh /app_pool/sap/log.sap 463M /app_pool/sap/log.sap TID{root}# mkfile 1500M /app_pool/saporg/org.log /app_pool/saporg/org.log: initialized 145752064 of 1572864000 bytes: No space left on device TID{root}# zfs list -r app_pool NAME USED AVAIL REFER MOUNTPOINT app_pool 1.95G 227K 35K /app_pool app_pool/sap 463M 227K 463M /app_pool/sap app_pool/sapdata 31K 227K 31K /app_pool/sapdata app_pool/saplog 31K 227K 31K /app_pool/saplog app_pool/saporg 95.7M 1.41G 95.7M /app_pool/saporg TID{root}# du -sh /app_pool/saporg/org.log 96M /app_pool/saporg/org.log TID{root}#In above I am trying to create 500MB file but actual free space left on the pool is 463MB so it got created only 463MB as we already set reservation of 1.5 GB to "app_pool/sap" dataset. Now I am creating 1.5GB file to reserved dataset "app_pool/saporg" and got above error. WHY?
TID{root}# rm /app_pool/saporg/org.log
TID{root}# rm /app_pool/sap/log.sap
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 1.50G 463M 35K /app_pool
app_pool/sap 31K 463M 31K /app_pool/sap
app_pool/sapdata 31K 463M 31K /app_pool/sapdata
app_pool/saplog 31K 463M 31K /app_pool/saplog
app_pool/saporg 40K 1.95G 40K /app_pool/saporg
TID{root}# mkfile 1500M /app_pool/saporg/org.log
TID{root}# du -sh /app_pool/saporg/org.log
1.5G /app_pool/saporg/org.log
TID{root}# zfs list -r app_pool
NAME USED AVAIL REFER MOUNTPOINT
app_pool 1.50G 463M 35K /app_pool
app_pool/sap 31K 463M 31K /app_pool/sap
app_pool/sapdata 31K 463M 31K /app_pool/sapdata
app_pool/saplog 31K 463M 31K /app_pool/saplog
app_pool/saporg 1.47G 499M 1.47G /app_pool/saporg
TID{root}#
Cool.. it got created. The reason is generally we need to maintain some free space in pool level, so I have removed both files "org.log and log.sap" and able created 1.5 GB file successfully.
In genral if you want to use normal file system e.g UFS and VXFS then you have to set quota and reservation so that you can use space constantly.
How to change mountpoint for dataset ?
In a traditional file system we have to do few of the tasks require to change mountpoint.
e.g
Umount file system
Make a new directory
Edit /etc/vfstab file
Mount file system with new mountpoint name.
but in ZFS it is very simple to change mountpoint for dataset to setting the properties.
To set properties for dataset mountpoint:
Here I am changing mountpoint for "app_pool/saporg" dataset.
TID{root}# df -h /app_pool/saporg
Filesystem size used avail capacity Mounted on
app_pool/saporg 2.0G 1.5G 499M 76% /app_pool/saporg
TID{root}# zfs get mountpoint app_pool/saporg
NAME PROPERTY VALUE SOURCE
app_pool/saporg mountpoint /app_pool/saporg default
TID{root}# zfs set mountpoint=/saporg app_pool/saporg
TID{root}# df -h /saporg
Filesystem size used avail capacity Mounted on
app_pool/saporg 2.0G 1.5G 499M 76% /saporg
TID{root}#
Thanks for reading this post , will post more article about ZFS...
0 comments:
Post a Comment