- •Alexandre Borges
- •Credits
- •Introduction 74
- •Chapter 3: Networking 159
- •Free access for Packt account holders
- •Instant updates on new Packt books
- •Table of Contents Preface 1 Chapter 1: ips and Boot Environments 7
- •Introduction 8
- •Installing a package, verifying its content, and fixing the package corruption 13
- •In an inactive boot environment 64
- •Chapter 2: zfs 73
- •Chapter 4: Zones 235
- •Preface
- •Questions
- •Ips and Boot
- •In this chapter, we will cover the following topics:
- •Introduction
- •Determining the current package publisher
- •Getting ready
- •Installing a package, verifying its content, and fixing the package corruption
- •Getting ready
- •Interface
- •Getting ready
- •Listing and renaming a boot environment
- •Getting ready
- •Configuring an ips local repository
- •Getting ready
- •Configuring a secondary ips local repository
- •Getting ready
- •Publishing packages into a repository
- •Getting ready
- •Adding big applications into a repository
- •Getting ready
- •Creating your own package and publishing it
- •Getting ready
- •Managing an ips publisher on Solaris 11
- •Getting ready
- •Pinning publishers
- •Getting ready
- •Getting ready
- •Creating a mirror repository
- •Getting ready
- •Getting ready
- •Listing and creating a boot environment
- •Getting ready
- •Getting ready
- •Activating a boot environment
- •Getting ready
- •Getting ready
- •References
- •Introduction
- •Creating zfs storage pools and filesystems
- •Getting ready
- •Playing with zfs faults and properties
- •Getting ready
- •Creating a zfs snapshot and clone
- •Getting ready
- •Performing a backup in a zfs filesystem
- •Getting ready
- •Handling logs and caches
- •Getting ready
- •Managing devices in storage pools
- •Getting ready
- •Configuring spare disks
- •Getting ready
- •Handling zfs snapshots and clones
- •Getting ready
- •Playing with comstar
- •Getting ready
- •Mirroring the root pool
- •Getting ready
- •Zfs shadowing
- •Getting ready
- •Configuring zfs sharing with the smb share
- •Getting ready
- •Setting and getting other zfs properties
- •Getting ready
- •Playing with the zfs swap
- •Getting ready
- •References
- •Networking
- •Introduction
- •Playing with Reactive Network Configuration
- •Getting ready
- •Internet Protocol Multipathing
- •Getting ready
- •Setting the link aggregation
- •Getting ready
- •Configuring network bridging
- •Getting ready
- •Getting ready
- •Configuring the dhcp server
- •Getting ready
- •Configuring Integrated Load Balancer
- •Getting ready
- •IPv4 forwarding enabled enabled
- •References
- •Introduction
- •Getting ready
- •Id name status path brand ip
- •Getting ready
- •Value is basic (only the owner can modify it).
- •22:52:06 5849 Rcapd
- •Implementing a flow control
- •Getting ready
- •Getting ready
- •Installing: This may take several minutes...
- •References
- •Playing with Oracle
- •Introduction
- •Reviewing smf operations
- •Getting ready
- •Its dependencies
- •Handling manifests and profiles
- •Getting ready
- •Creating smf services
- •Getting ready
- •Getting ready
- •Troubleshooting Oracle Solaris 11 services
- •Getting ready
- •References
- •Configuring and
- •Introduction
- •Getting ready
- •References
- •Configuring and
- •Introduction
- •Configuring and using rbac
- •Getting ready
- •Playing with least privileges
- •Getting ready
- •References
- •Administering and
- •Introduction
- •Monitoring and handling process execution
- •Getting ready
- •2014 May 4 19:25:10, load average: 0.38, 0.30, 0.28 syscalls: 12648
- •Managing processes' priority on Solaris 11
- •Getting ready
- •Configuring fss and applying it to projects
- •Getting ready
- •References
- •Isbn-13: 978-0131568198
- •Configuring the
- •Introduction
- •Configuring the syslog
- •Getting ready
- •Getting ready
- •References
- •Aggregation 191
- •Identifier (fmri) 294 faults, zfs
- •(Trill) 198
- •Values, l4 (Communication)
- •Virtual ip address (vip address) 228 virtual memory size (vsz) 396 virtual network interface (vnic) 238 virtual network, zone
- •Virtual to virtual (v2v) migration 280
- •About Packt Enterprise
- •Writing for Packt
Setting and getting other zfs properties
Managing ZFS properties is one of the secrets when we are working with the ZFS filesystem, and this is the reason why understanding the inherence concept is very important.
One ZFS property can usually have three origins as source: local (the property value was set locally), default (the property wasn't set either locally or by inheritance), and inherited (the property was inherited from an ancestor). Additionally, two other values are possible: temporary (the value isn't persistent) and none (the property is read-only, and its value was generated by ZFS). Based on these key concepts, the sections are going to present different and interesting properties for daily administration.
Getting ready
This recipe can be followed using two virtual machines (VirtualBox or VMware) with Oracle Solaris 11 installed, 4 GB RAM, and eight disks of at least 4 GB.
How to do it…
Working as a small review, datasets such as pools, filesystems, snapshots, and clones have several properties that administrators are able to list, handle, and configure. Therefore, the following commands will create a pool and three filesystems under this pool. Additionally, we are going to copy some data (a reminder again—we could use any data) into the first filesystem as follows:
root@solaris11-1:~# zpool create prop_pool c8t5d0 root@solaris11-1:~# zfs create prop_pool/zfs_1 root@solaris11-1:~# zfs create prop_pool/zfs_2 root@solaris11-1:~# zfs create prop_pool/zfs_3
root@solaris11-1:~# cp -r socat-2.0.0-b6.tar.gz dtbook_scripts* /prop_ pool/zfs_1
To get all the properties from a pool and filesystem, execute the following command:
root@solaris11-1:~# zpool get all prop_pool
NAME PROPERTY VALUE SOURCE
prop_pool allocated 1.13M -
prop_pool altroot - default
prop_pool autoexpand off default
prop_pool autoreplace off default
prop_pool bootfs - default
prop_pool cachefile - default
ZFS
prop_pool capacity 0% -
prop_pool dedupditto 0 default
prop_pool dedupratio 1.00x -
prop_pool delegation on default
prop_pool failmode wait default
prop_pool free 3.97G -
prop_pool guid 10747479388132741479 - prop_pool health ONLINE -
prop_pool listshares off default
prop_pool listsnapshots off default
prop_pool readonly off -
prop_pool size 3.97G -
NAME |
PROPERTY |
VALUE |
SOURCE |
prop_pool/zfs_1 |
aclinherit |
restricted |
default |
prop_pool/zfs_1 |
aclmode |
discard |
default |
prop_pool/zfs_1 |
atime |
on |
default |
prop_pool/zfs_1 |
available |
3.91G |
|
prop_pool version 34 default root@solaris11-1:~# zfs get all prop_pool/zfs_1
(truncated output)
Both commands have a similar syntax, and we've got all the properties from the prop_pool
pool and the prop_pool/zfs_1 filesystem.
In the ZFS shadowing section, we touched the NFS subject, and some filesystems were shared using the share command. Nonetheless, they could have been shared using ZFS properties, such as sharenfs, that have a value equal to off by default (when we use this value, it isn't managed by ZFS and is still using /etc/dfs/dfstab). Let's take the sharenfs property, which will be used to highlight some basic concepts about properties.
As usual, the property listing is too long; it is faster to get only one property's value by executing the following command:
root@solaris11-1:~# zfs get sharenfs prop_pool
NAME PROPERTY VALUE SOURCE
prop_pool share.nfs off default
root@solaris11-1:~# zfs get sharenfs prop_pool/zfs_1
NAME PROPERTY VALUE SOURCE
prop_pool/zfs_1 share.nfs off default
Chapter 2
Moreover, the same property can be got recursively by running the following command:
root@solaris11-1:~# zfs get -r sharenfs prop_pool
NAME PROPERTY VALUE SOURCE
prop_pool share.nfs off default prop_pool/zfs_1 share.nfs off default prop_pool/zfs_2 share.nfs off default prop_pool/zfs_3 share.nfs off default
From the last three outputs, we noticed that the sharenfs property is disabled on the pool and filesystems, and this is the default value set by Oracle Solaris 11.
The sharenfs property can be enabled by executing the following command:
root@solaris11-1:~# zfs set sharenfs=on prop_pool/zfs_1 root@solaris11-1:~# zfs get -r sharenfs prop_pool/zfs_1 NAME PROPERTY VALUE SOURCE
prop_pool/zfs_1 share.nfs on local
prop_pool/zfs_1% share.nfs on inherited from prop_pool/zfs_1
As sharenfs was set to on for prop_pool/zfs_1, the source value has changed to local, indicating that this value wasn't inherited, but it was set locally. Therefore, execute the following command:
root@solaris11-1:~# zfs get -s local all prop_pool/zfs_1
NAME PROPERTY VALUE SOURCE
prop_pool/zfs_1 share.* ... local root@solaris11-1:~# zfs get -r sharenfs prop_pool NAME PROPERTY VALUE SOURCE
prop_pool share.nfs off default prop_pool/zfs_1 share.nfs on local
prop_pool/zfs_1% share.nfs on inherited from prop_pool/zfs_1 prop_pool/zfs_2 share.nfs off default
prop_pool/zfs_3 share.nfs off default
The NFS sharing can be confirmed by running the following command:
root@solaris11-1:~# share
IPC$ smb - Remote IPC
c$ /var/smb/cvol smb - Default Share prop_pool_zfs_1 /prop_pool/zfs_1 nfs sec=sys,rw
ZFS
Creating a new file stem under zfs_1 shows us an interesting characteristic. Execute the following command:
root@solaris11-1:~# zfs create prop_pool/zfs_1/zfs_4 root@solaris11-1:~# zfs get -r sharenfs prop_pool NAME PROPERTY VALUE SOURCE
prop_pool share.nfs off default prop_pool/zfs_1 share.nfs on local
prop_pool/zfs_1% share.nfs on inherited from prop_pool/zfs_1 prop_pool/zfs_1/zfs_4 share.nfs on inherited from prop_pool/zfs_1 prop_pool/zfs_1/zfs_4% share.nfs on inherited from prop_pool/zfs_1 prop_pool/zfs_2 share.nfs off default
prop_pool/zfs_3 share.nfs off default
The new zfs_4 filesystem has the sharenfs property inherited from the upper zfs_1
filesystem; now execute the following command to list all the inherited properties:
root@solaris11-1:~# zfs get -s inherited all prop_pool/zfs_1/zfs_4
NAME PROPERTY VALUE SOURCE
prop_pool/zfs_1/zfs_4 share.* ... inherited root@solaris11-1:~# share
IPC$ smb - Remote IPC
c$ /var/smb/cvol smb - Default Share prop_pool_zfs_1 /prop_pool/zfs_1 nfs sec=sys,rw
prop_pool_zfs_1_zfs_4 /prop_pool/zfs_1/zfs_4 nfs sec=sys,rw
That's great! The new zfs_4 filesystem has inherited the sharenfs property, and it appears
in the share output command.
A good question is whether a filesystem will be able to fill all the space of a pool. Yes, it will be able to! Now, this is the reason for ZFS having several properties related to the amount of space on the disk. The first of them, the quota property, is a well-known property that limits how much space a dataset (filesystem in this case) can fill in a pool. Let's take an example:
root@solaris11-1:~# zfs list -r prop_pool
NAME USED AVAIL REFER MOUNTPOINT
prop_pool 399M 3.52G 391M /prop_pool prop_pool/zfs_1 8.09M 3.52G 8.06M /prop_pool/zfs_1 prop_pool/zfs_1/zfs_4 31K 3.52G 31K /prop_pool/zfs_1/zfs_4 prop_pool/zfs_2 31K 3.52G 31K /prop_pool/zfs_2 prop_pool/zfs_3 31K 3.52G 31K /prop_pool/zfs_3
Chapter 2
All filesystems struggle to use the same space (3.52G), and one of them can fill more space than the other (or all the free space), so it is possible that a filesystem suffered a "run out space" error. A solution would be to limit the space a filesystem can take up by executing the following command:
root@solaris11-1:~# zfs quota=1G prop_pool/zfs_3
root@solaris11-1:~# zfs list -r prop_pool
NAME USED AVAIL REFER MOUNTPOINT
prop_pool 399M 3.52G 391M /prop_pool prop_pool/zfs_1 8.09M 3.52G 8.06M /prop_pool/zfs_1 prop_pool/zfs_1/zfs_4 31K 3.52G 31K /prop_pool/zfs_1/zfs_4 prop_pool/zfs_2 31K 3.52G 31K /prop_pool/zfs_2 prop_pool/zfs_3 31K 1024M 31K /prop_pool/zfs_3
The zfs_3 filesystem space was limited to 1 GB, and it can't exceed this threshold. Nonetheless, there isn't any additional guarantee that it has 1 GB to fill. This is subtle—it can't exceed 1 GB, but there is no guarantee that even 1 GB is enough for doing it. Another serious detail—this quota space is shared by the filesystem and all the descendants such as snapshots and clones. Finally and obviously, it isn't possible to set a quota value lesser than the currently used space of the dataset.
A solution for this apparent problem is the reservation property. When using reservation, the space is guaranteed for the filesystem, and nobody else can take this space. Sure, it isn't possible to make a reservation above the quota or maximum free space, and the same rule is followed—the reservation is for a filesystem and its descendants.
When the reservation property is set to a value, this amount is discounted from the total available pool space, and the used pool space is increased by the same value:
root@solaris11-1:~# zfs list -r prop_pool
NAME USED AVAIL REFER MOUNTPOINT
prop_pool 399M 3.52G 391M /prop_pool prop_pool/zfs_1 8.09M 3.52G 8.06M /prop_pool/zfs_1 prop_pool/zfs_1/zfs_4 31K 3.52G 31K /prop_pool/zfs_1/zfs_4 prop_pool/zfs_2 31K 3.52G 31K /prop_pool/zfs_2 prop_pool/zfs_3 31K 1024M 31K /prop_pool/zfs_3
Each dataset under prop_pool has its reservation property:
root@solaris11-1:~# zfs get -r reservation prop_pool
NAME PROPERTY VALUE SOURCE
prop_pool reservation
none
default
prop_pool/zfs_1
reservation none default prop_pool/zfs_1% reservation -
-
-
ZFS
prop_pool/zfs_1/zfs_4
reservation
none
default
prop_pool/zfs_1/zfs_4%
reservation
-
-
prop_pool/zfs_2
reservation
none
default
prop_pool/zfs_3
reservation
none
default
The reservation property is configured to a specific value (for example, 512 MB), given that this amount is subtracted from the pool's available space and added to its used space. Now, execute the following command:
root@solaris11-1:~# zfs set reservation=512M prop_pool/zfs_3
root@solaris11-1:~# zfs list -r prop_pool
NAME USED AVAIL REFER MOUNTPOINT
prop_pool 911M 3.02G 391M /prop_pool prop_pool/zfs_1 8.09M 3.02G 8.06M /prop_pool/zfs_1 prop_pool/zfs_1/zfs_4 31K 3.02G 31K /prop_pool/zfs_1/zfs_4 prop_pool/zfs_2 31K 3.02G 31K /prop_pool/zfs_2 prop_pool/zfs_3 31K 1024M 31K /prop_pool/zfs_3 root@solaris11-1:~# zfs get -r reservation prop_pool
NAME PROPERTY VALUE SOURCE
prop_pool reservation none default prop_pool/zfs_1 reservation none default prop_pool/zfs_1% reservation - - prop_pool/zfs_1/zfs_4 reservation none default prop_pool/zfs_1/zfs_4% reservation - - prop_pool/zfs_2 reservation none default prop_pool/zfs_3 reservation 512M local
The concern about space is usually focused on a total value for the whole pool, but it's possible to limit the available space for individual users or groups.
Setting the quota for users is done through the userquota property and for groups using the
groupquota property:
root@solaris11-1:~# zfs set userquota@aborges=750M
prop_pool/zfs_3
root@solaris11-1:~# zfs set userquota@alexandre=1.5G prop_pool/zfs_3
root@solaris11-1:~# zfs get userquota@aborges prop_pool/zfs_3
NAME PROPERTY VALUE SOURCE
prop_pool/zfs_3 userquota@aborges 750M local root@solaris11-1:~# zfs get userquota@alexandre prop_pool/zfs_3
Chapter 2
NAME PROPERTY VALUE SOURCE
prop_pool/zfs_3 userquota@alexandre 1.50G local root@solaris11-1:~# zfs set groupquota@staff=1G prop_pool/zfs_3 root@solaris11-1:~# zfs get groupquota@staff prop_pool/zfs_3 NAME PROPERTY VALUE SOURCE
prop_pool/zfs_3 groupquota@staff 1G local
Getting the used and quota space from users and groups is done by executing the following command:
root@solaris11-1:~# zfs userspace prop_pool/zfs_3
TYPE NAME USED QUOTA
POSIX User aborges 0 750M POSIX User alexandre 0 1G POSIX User root 3K none
root@solaris11-1:~# zfs groupspace prop_pool/zfs_3
TYPE NAME USED QUOTA
POSIX Group root 3K none POSIX Group staff 0 1G
Removing all the quota values that were set until now is done through the following sequence:
root@solaris11-1:~# zfs set quota=none prop_pool/zfs_3 root@solaris11-1:~# zfs set userquota@aborges=none prop_pool/zfs_3 root@solaris11-1:~# zfs set userquota@alexandre=none prop_pool/zfs_3 root@solaris11-1:~# zfs set groupquota@staff=none prop_pool/zfs_3 root@solaris11-1:~# zfs userspace prop_pool/zfs_3
TYPE NAME USED QUOTA
POSIX User root 3K none
root@solaris11-1:~# zfs groupspace prop_pool/zfs_3
TYPE NAME USED QUOTA
POSIX Group root 3K none
An overview of the recipe
In this section, you saw some properties such as sharenfs, quota, reservation, userquota, and groupquota. All of the properties alter the behavior of the ZFS pool, filesystems, snapshots, and clones. Moreover, there are other additional properties that can improve the ZFS functionality, and I suggest that readers look for all of them in ZFS Administration Guide.
ZFS
