| ||||||||||||
5.6.1 Setting QuotasZFS quotas can be set and displayed with the zfs set and zfs get commands. The following example sets a quota of 10 Gbytes on tank/home/bonwick.
ZFS quotas also impact the output of the zfs list and df commands.
Note that although tank/home has 33.5 Gbytes of space available, tank/home/bonwick and tamk/home/bonwick/ws only have 10 Gbytes of space available, due to the quota on tank/home/bonwick. It is not possible to set a quota to an amount less than is currently being used by a dataset.
5.6.2 Setting ReservationsA ZFS reservation is an allocation of space from the pool that is guaranteed to be available to a dataset. As such, it is not possible to reserve space for a dataset if that space is not currently available in the pool. The total of all outstanding unconsumed reservations cannot exceed the amount of unused space in the pool. ZFS reservations can be set and displayed with the zfs set and zfs get commands.
ZFS reservations can influence the output of the zfs list command.
Note that tank/home shows that it is using 5 Gbytes of space, although the total space referred to by tank/home and its descendants is much less than 5 Gbytes. The used space reflects the space reserved for tank/home/moore. Reservations are accounted for in the used space of the parent dataset and do count against its quota and/or reservation.
A dataset can use more space than its reservation, so long as there is space available in the pool that is unreserved and it is below its quota. A dataset cannot consume space that has been reserved for another dataset. Reservations are not cumulative. That is, a second invocation of zfs set to set a reservation does not add its reservation to the existing one, rather it replaces it.
5.7 Backing Up and Restoring ZFS DataYou can backup and restore ZFS filesystem snapshots and the original filesystems by using the zfs backup and zfs restore commands. The following ZFS backup and restore solutions are provided:
Consider the following when choosing a ZFS backup solution:
5.7.1 Backing Up ZFS Filesystems With Other Backup ProductsIn addition to the zfs backup and zfs restore commands, you can also use backup utilities, such as the tar and cpio commands, to back up ZFS files. All of these utilities backup and restore ZFS file attributes and ACLs. Check the appropriate options for both the tar and cpio commands. Keep the following issues in mind when using other backup products to back up ZFS files:
5.7.2 Backing Up a ZFS SnapshotThe simplest form of the zfs backup command is to backup a snapshot. For example:
You can create an incremental backup by using the zfs backup -i option. For example:
Note that the first argument is the earlier snapshot and the second argument is the later snapshot. If you need to store many backups, you might consider compressing a ZFS backup with gzip. For example:
5.7.3 Restoring a ZFS SnapshotWhen you restore a file system snapshot, the file system is restored as well. The file system is unmounted and is inaccessible while it is being restored. In addition, the original file system to be restored must not exist while it is being restored. If there is a conflicting filesystem name, zfs rename can be used to rename it. For example:
When you restore an incremental file system snapshot, the most recent snapshot must first be rolled back. In addition, the destination file system must exist. To restore the previous incremental backup for tank/dana, for example:
During the incremental restore process, the filesystem is unmounted and cannot be accessed. | ||||||||||||
| ||||||||||||