zfs_appliance
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| zfs_appliance [2018/12/08 12:49] – created 0.0.0.0 | zfs_appliance [2019/01/30 11:32] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== ZFS_Appliance ====== | + | ==== List the sizes and available space in all filesystems on ZFS appliance ==== |
| - | + | * [[https:// | |
| - | =====List the sizes and available space in all filesystems on ZFS appliance===== | + | |
| - | * [[https:// | + | |
| Make sure to be in the root context before running this. | Make sure to be in the root context before running this. | ||
| - | < | + | < |
| + | script | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | ', ' | ||
| + | |||
| + | for (i = 0; i < projects.length; | ||
| + | | ||
| + | | ||
| + | |||
| + | for (j = 0; j < shares.length; | ||
| + | | ||
| + | |||
| + | share = projects[[i]] + '/' | ||
| + | used = run(' | ||
| + | avail = run(' | ||
| + | |||
| + | | ||
| + | ', share, used, avail); | ||
| + | | ||
| + | } | ||
| + | |||
| + | | ||
| + | } | ||
| + | . | ||
| + | </ | ||
| and the same information but " | and the same information but " | ||
| - | < | + | < |
| - | =====Create a pool===== | + | script |
| - | < | + | fmt = '%-40s %-15s %-15s\ |
| - | =====Create a ZFS filesystem / dataset in the pool===== | + | '; |
| - | < | + | printf(fmt, ' |
| + | run(' | ||
| + | run(' | ||
| + | pools = choices(' | ||
| + | for (p = 0; p < pools.length; | ||
| + | set(' | ||
| + | projects = list(); | ||
| + | for (i = 0; i < projects.length; | ||
| + | run(' | ||
| + | shares = list(); | ||
| + | for (j = 0; j < shares.length; | ||
| + | run(' | ||
| + | share = pools[[p]] + ':' | ||
| + | printf(fmt, share, get(' | ||
| + | get(' | ||
| + | run(' | ||
| + | } | ||
| + | run(' | ||
| + | } | ||
| + | } | ||
| + | . | ||
| + | </ | ||
| + | ==== Create a pool ==== | ||
| + | < | ||
| + | [[sudo]] zfs create datapool mirror /dev/sdc /dev/sdd | ||
| + | [[sudo]] zfs list | ||
| + | </ | ||
| + | ==== Create a ZFS filesystem / dataset in the pool ==== | ||
| + | < | ||
| + | [[sudo]] zfs create datapool/ | ||
| [[sudo]] zfs list -r datapool | [[sudo]] zfs list -r datapool | ||
| - | =====Create a snapshot of the filesystem===== | + | ==== Create a snapshot of the filesystem ==== |
| - | < | + | < |
| - | =====Destroy a snapshot===== | + | [[sudo]] zfs snapshot datapool/ |
| - | < | + | [[sudo]] zfs list -t snapshot |
| - | =====Rollback a snapshot===== | + | </ |
| - | ====Create a file followed by a snapshot to preserve situation==== | + | ==== Destroy a snapshot ==== |
| - | < | + | < |
| - | ====Change the contents of the file==== | + | [[sudo]] zfs destroy datapool/ |
| - | < | + | [[sudo]] zfs list -t snapshot |
| - | =====Rename a snapshot===== | + | </ |
| - | < | + | ==== Rollback a snapshot ==== |
| - | =====Destroy a filesystem===== | + | === Create a file followed by a snapshot to preserve situation === |
| - | < | + | < |
| + | [[sudo]] echo " | ||
| + | [[sudo]] cat / | ||
| + | [[sudo]] zfs snapshot datapool/ | ||
| + | [[sudo]] zfs list -t snapshot | ||
| + | </ | ||
| + | === Change the contents of the file === | ||
| + | < | ||
| + | [[sudo]] echo " | ||
| + | [[sudo]] cat / | ||
| + | === Rollback to previous snapshot and see original file contents | ||
| + | < | ||
| + | [[sudo]] zfs list -t snapshot | ||
| + | [[sudo]] zfs rollback datapool/ | ||
| + | [[sudo]] cat / | ||
| + | [[sudo]] zfs list -t snapshot | ||
| + | </ | ||
| + | ==== Rename a snapshot ==== | ||
| + | < | ||
| + | [[sudo]] zfs rename datapool/ | ||
| + | [[sudo]] zfs list -t snapshot | ||
| + | </ | ||
| + | ==== Destroy a filesystem ==== | ||
| + | < | ||
| + | [[sudo]] zfs destroy datapool/ | ||
| + | [[sudo]] zfs list -r datapool | ||
| + | </ | ||
| If there are snapshots of the filesystem, add -r to force the destruction | If there are snapshots of the filesystem, add -r to force the destruction | ||
| - | < | + | < |
| - | =====Create a clone===== | + | [[sudo]] zfs destroy -r datapool/ |
| - | Clones can only be created from a snapshot.<br /> | + | [[sudo]] zfs list -t snapshot |
| - | Snapshots cannot be deleted unless the clone is deleted.<br /> | + | </ |
| + | ==== Create a clone ==== | ||
| + | Clones can only be created from a snapshot.\\ | ||
| + | Snapshots cannot be deleted unless the clone is deleted.\\ | ||
| Clone the snapshot datapool/ | Clone the snapshot datapool/ | ||
| - | < | + | < |
| - | ====Attempt to destroy underlying snapshot==== | + | [[sudo]] zfs clone datapool/ |
| - | < | + | zfs list |
| - | ====Attempt to destroy underlying snapshot==== | + | ls / |
| - | < | + | </ |
| - | ====Destroy clone first==== | + | === Attempt to destroy underlying snapshot === |
| - | < | + | < |
| - | ====Attempt to destroy underlying snapshot again==== | + | </ |
| - | < | + | === Attempt to destroy underlying snapshot === |
| + | < | ||
| + | [[sudo]] zfs destroy datapool/ | ||
| + | </ | ||
| + | === Destroy clone first === | ||
| + | < | ||
| + | [[sudo]] zfs destroy datapool/ | ||
| + | </ | ||
| + | === Attempt to destroy underlying snapshot again === | ||
| + | < | ||
| + | [[sudo]] zfs destroy datapool/ | ||
| + | </ | ||
zfs_appliance.1544273361.txt.gz · Last modified: 2018/12/08 12:49 by 0.0.0.0
