ZFS just bristles with potential. Quotas, Reservations, turning compression or atime updates on or off without unmounting. The list goes on.
So now that we have ZFS root (Since Nevada build SNV_90, and even earlier when using OpenSolaris or other distributions) lets start to make use of these features.
First thing is, on my computer I don't care about access time updates on files or directories, so I disable it.
/ $ pfexec zfs set atime=off rpool |
That is not particularly spectacular in itself, but since it is there I use it. The idea is of course to save a few disk updates and the corresponding IOs.
Next: core dumps. One of my pet hates. Many processes dumps core in your home dir, these get overwritten or forgotten, and then there are any number of core files lying around all over the file systems, all off these just wasting space since I don't really intent do try to analyze any of them.
Solaris has got a great feature by which core dumps can be all directed to go to a single directory and, on top of that, to have more meaningful file names.
So the idea is to create a directory, say /var/cores and then store the core files in there for later review. But knowing myself these files will just continue to waste space until I one day decide to actually try and troubleshoot a specific issue.
To me this sounds like a perfect job for ZFS.
First I check that there is not already something called /var/cores:
/ $ ls /var/cores |
Great. Now I create it.
/ $ pfexec zfs create rpool/export/cores |
And set a limit on how much space it can ever consume:
/ $ pfexec zfs set quota=2g rpool/export/cores |
Note: This can easily be changed at any time, simply by setting a new quota.
Which creates the below picture.
|
And checking the settings on the /var/cores ZFS file system
|
Note that Access-time updates on this file system is off - the setting has been inherited from the pool. The only "local" settings are the mountpoint and the quota which corresponds to the items that I've specified manually.
Now just to make new core files actually use this directory. At present, the default settings from coreadm looks like this:
|
Looking at the coreadm man page, there is a fair amount of flexibility in what can be done. I want core files to have a name identifying the zone in which the process was running, the process executable file, and the user. I also don't want core dumps to overwrite when the same process keeps on faulting, so I will add a time stamp to the core file name.
/ $ pfexec coreadm -g /var/core/core.%z.%f.%u.%t |
And then I would like to enable logging of an event any time when a core file is generated, and also to store core files for Set-UID processes:
/ $ pfexec coreadm -e global-setid -e log |
And finally, just to review the core-dump settings, these now look like this:
|
Now if that is not useful, I don't know what is! You will soon start to appreciate just how much space is wasted and just how truly rigid and inflexible other file systems are once you run your machine with a ZFS root!
No comments:
Post a Comment