Storage Management (ZFS)
Storage Management (ZFS)
4
SOP: STORAGE MANAGEMENT
ZFS File-system
ZFS is a local file system and Logical Volume Manager created by SUN MICROSYSTEMS to direct
and control the placement, storage and retrieval of data in enterprise-class computing systems.
The ZFS file system and volume manager is characterized by data integrity, high scalability and built-in
storage features such as:
• Replication - The process of making a replica (a copy) of something.
• Deduplication - A process that eliminates redundant copies of data and reduces storage
overhead.
• Compression - A reduction in the number of bits needed to represent data.
• Snapshots - A set of reference markers for data at a particular point in time.
• Clones - An identical copy of something.
• Data protection - The process of safeguarding important information from corruption and/or
loss.
1. zfs file-system created by zfs command in created pool. In command after sda1/ we have to
name of file system.
3. Mounting File-System:
1. If you not mount the file system and system configured with automount then by default it
will get mounted by creating directories namely its dataset as shown in below.
2. Follow the following, if you want to mount it on any other mount point.
4. ZFS Quota and Reservation settings:
ZFS supports quotas and reservations at the file system level. You can use the quota property to
set a limit on the amount of space a file system can use. In addition, you can use the reservation
property to guarantee that some amount of space is available to a file system. Both properties
apply to the dataset they are set on and all descendants of that dataset.
That is, if a quota is set on the rpool/export/home dataset, the total amount of space used by
tank/home and all of its descendants cannot exceed the quota. Similarly, if rpool/export/home is
given a reservation, rpool/export/home and all of its descendants draw from that reservation.
The amount of space used by a dataset and all of its descendents is reported by the used
property.
A. Quota: You can set quota for zfs file system, specific user and group by zfs command.
2. User quota :
2. If you set for user home directory then the space is reserved for that user home .directory
in rpool/export/home dataset.
1. Linear :
1. If you provide command ‘zpool create ’ with no option then it will implements
concatenation between the provided no. of disk.
3. You can check your pool and file system: As discussed in point 3. you can change mount
point of file system. 3 disks are having total size of 2 GB and grand total is 6 GB
2. Mirroring: If you provide command ‘zpool create ’ with option ‘raid1/2/so on’ then it will
implements mirror of the disk. The no. of mirror depends on provided no. of disk.
1. Single mirror :
3 disks are having total size of 2 GB , 1 contain data and other 2 are the replica’s of disk 1.
The raidz1 vdev type specifies a single-parity raidz group; the raidz2 vdev type specifies a
double-parity raidz group; and the raidz3 vdev type specifies a triple-parity raidz group. The
raidz vdev type is an alias for raidz1.
-raidz3 requires at least 4 devices
-raidz2 requires at least 3 devices
-raidz requires at least 2 devices
A raidz group with N disks of size X with P parity disks can hold approximately (N-P)*X
bytes and can withstand P device(s) failing before data integrity is compromised. The
minimum number of devices in a raidz group is one more than the number of parity disks. The
recommended number is between 3 and 9 to help increase performance.
1. Snapshot:
A snapshot is a read-only copy of a file system or volume. Snapshots can be created almost
instantly, and they initially consume no additional disk space within the pool. However, as data
within the active dataset changes, the snapshot consumes disk space by continuing to reference
the old data, thus preventing the disk space from being freed.
ZFS snapshots include the following features:
1. The persist across system reboots.
2. The theoretical maximum number of snapshots is 264.
3. Snapshots use no separate backing store. Snapshots consume disk space directly from the
same storage pool as the file system or volume from which they were created.
4. Snapshots of volumes cannot be accessed directly, but they can be cloned, backed up, rolled
back to, and so on.
2. Rollback:
You can use the ‘zfs rollback’ command to discard all changes made to a file system since a
specific snapshot was created. The file system reverts to its state at the time the snapshot was
taken. By default, the command cannot roll back to a snapshot other than the most recent
snapshot.
To roll back to an earlier snapshot, all intermediate snapshots must be destroyed. You can
destroy earlier snapshots by specifying the -r option.
If clones of any intermediate snapshots exist, the -R option must be specified to destroy the
clones as well.
• You can list out the snapshots by zfs command. With option t for type.
• Removing directories.
• Now rollback to previous state. Syntax- zfs rollback NAME (as mentioned at the time of
creating)
• Now check whether state is backed up or not.
9. ZFS Clones :
A clone is a writable volume or file system whose initial contents are the same as the dataset from
which it was created. As with snapshots, creating a clone is nearly instantaneous and initially consumes
no additional disk space. In addition, you can snapshot a clone.
Clones can only be created from a snapshot. When a snapshot is cloned, an implicit dependency is
created between the clone and snapshot. Even though the clone is created somewhere else in the dataset
hierarchy, the original snapshot cannot be destroyed as long as the clone exists. The origin property
exposes this dependency, and the zfs destroy command lists any such dependencies, if they exist.
• Features of clones :
➢ Snapshot Testing : You can create a clone from a snapshot of an existing file system,
allowing you to test, updates, or modifications without affecting the original data.
If clones doesn’t work as expected, you can simply delete it.
If clones work as expected, then promote it. And replace the original file with clones.
➢ COW : ZfS uses a Copy-on-write (COW) mechanism, which means that when data is
modified, a new block is written instead of overwriting the original.
➢ Versioning : Clone can be used to create versioned copies of data. This can be helpful in
scenarios where you want to maintain a history of changes or different states of a file
system.
➢ Lightweight copies : Creating a clone is a lightweight operation in zfs. It doesn’t consume
additional space until changes are made to clone.
1. Creating clones from snapshot :
2. After testing, any changes are made on clones or cloned file-system and that changes are fulfill
our expectations then that clone will be promoted and renamed by original existing file and
existing original file (unchanged file) will be renamed as like older file system.