There is quite a number of ZFS filesystems properties, and I will cover most useful ones today.
I’ll begin with refreshing your knowledge a bit. As I’ve told before, I’m going to create a number of ZFS filesystems on my server for the next few blog entires on ZFS. So, right now I have the following:
solaris# zfs list
NAME USED AVAIL REFER MOUNTPOINT
stock 2.40G 31.1G 8.50K /stock
stock/oracle 2.32G 693M 2.32G /stock/oracle
stock/try 8K 512M 8K /try
To get a value of some ZFS property, we normally use a command like this:
solaris# zfs get used stock/try
NAME PROPERTY VALUE SOURCE stock/try used 8K -
But such output isn’t always convenient for us – it’s formatted this way to make the data more human readable. But if we’re going to use
solaris# zfs get
to obtain some ZFS parameters from our scripts, we really don’t need anything fancy. So we’re probably better off using a special -H command line option:
solaris# zfs get -H used stock/try stock/try used 8K -
One more thing – a useful, yet very obvious feature which allows you specifying few properties names in one command line:
solaris# zfs get -H used,available,mounted stock/try stock/try used 8K - stock/try available 512M - stock/try mounted yes -
Okay, now let’s move on and look at some useful ZFS filesystems properties.
For instance, the mountpoint property name speaks for itself. By default, the filesystem which you change the mountpoint for, will be automatically remounted at a new location:
solaris# zfs set mountpoint=/younameit stock/try solaris# zfs list NAME USED AVAIL REFER MOUNTPOINT stock 2.40G 31.1G 8.50K /stock stock/oracle 2.32G 693M 2.32G /stock/oracle stock/try 8K 512M 8K /younameit solaris# df -k | grep stock stock 35112960 8 32597477 1% /stock stock/oracle 3145728 2436188 709540 78% /stock/oracle stock/try 524288 8 524280 1% /younameit
One more potentially useful option is an on-disk compression. It happens on the fly, and it is planned to eventually have a number of compression methods available to a ZFS administrator, but at the moment you can use only one method – lzjb.
Still, results are impressive:
solaris# ls -l /younameit/access_log total 3082 drwxr-xr-x 2 root sys 3 Jan 23 21:59 . drwxr-xr-x 44 root root 1024 Jan 23 21:45 .. dr-xr-xr-x 3 root root 3 Jan 23 22:04 .zfs -rw-r--r-- 1 root root 8904090 Jan 23 21:59 access_log solaris# zfs list NAME USED AVAIL REFER MOUNTPOINT stock 2.41G 31.1G 8.51M /stock stock/oracle 2.32G 693M 2.32G /stock/oracle stock/try 1.51M 510M 1.51M /younameit
No wonder the compression ratio is so good for this filesystem:
solaris# zfs get compressratio stock/try NAME PROPERTY VALUE SOURCE stock/try compressratio 5.63x -
Unfortunately, only few types of files can be so wonderfully compressed, and text files (for instance, my Apache2 logs) belong to them too. Executable files, of course, will compress with a much lower ratio.
I think that should do for today’s entry. Let me tell you right now: I have a whole series of ZFS blog entries planned ahead, and that’s the reason I haven’t covered some of the simpler ZFS filesystem options yet. I promise to write more in the nearest few days.
Hitesh says
Nice One.
Thanks Buddy.