Skip to content

Commit

Permalink
Add OpenZFS Cheat sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoullain committed Oct 23, 2017
1 parent 3a7b664 commit 943b7bb
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 0 deletions.
Binary file added assets/images/openzfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ <h1><i class="material-icons">build</i> tools</h1>
</div>
<div class="title">docker-swarm</div>
</a>
</div><div class="item">
<a href="./openzfs/index.html">
<div class="img-item">
<img src="./assets/images/openzfs.png"/>
</div>
<div class="title">OpenZFS</div>
</a>
</div><!-- inject a new cheat sheet tools -->
</div>
</section>
Expand Down
34 changes: 34 additions & 0 deletions src/openzfs/first-side/column1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# zpool – configure ZFS storage pools

___A ZFS storage pool is a logical collection of devices that provide space for datasets.___

List pool health status and space usage
`zpool list`

Display the detailed health status
`zpool status`
`zpool status -x`

Create a new storage pool
`zpool create <pool> <disk>`

Create a new storage pool (RAID1)
`zpool create <pool> mirror <first_disk> <second_disk>`

Grow-up a storage pool
`zpool add <pool> <disk>`

Remove a storage pool
`zpool destroy <pool>`

Import a storage pool
`zpool import <pool>|<pool_id>`

Export a storage pool
`zpool export <pool>|<pool_id>`

Display I/O statistics
`zpool iostat <interval>`

Display the command history
`zpool history <pool>`
36 changes: 36 additions & 0 deletions src/openzfs/first-side/column2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# zfs – configure ZFS file systems

___A ZFS dataset of type filesystem can be mounted.___

List the property information for the fs-type datasets
`zfs list`

Create a new ZFS file system
`zfs create <pool>/<dataset>`

Remove a ZFS file system
`zfs destroy <pool>/<dataset>`

Set mount point for a dataset
`zfs set mountpoint=<path> <pool>/<dataset>`

Mount and umount a ZFS file system
`zfs mount [-o mountpoint=<dir>]<pool>/<dataset>`
`zfs umount <pool>/<dataset>`

Limit the amount of space a dataset can consume
`zfs set refquota=<size> <pool>/<dataset>`

Guaranty minimum amount of space to a dataset
`zfs set refreservation=<size> <pool>/<dataset>`


# zfs – configure ZFS volumes

___A ZFS dataset of type volume is a logical volume exported as a raw or block device.___

Create a volume with reservation (thick)
`zfs create -V <size> <volume>`

Creates a sparse volume with no reservation
`zfs create -s -V <size> <volume>`
48 changes: 48 additions & 0 deletions src/openzfs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Droid+Sans:700" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="../common.css">
<link rel="stylesheet" href="../common/lib/atom-one-light.css">
<link rel="stylesheet" href="./@@folder.css">
</head>
<body>
<input type="checkbox" id="showPreview"/>
<div class="first-side">
@@include('../../dist/common/first-side/header.html', {"title": "OpenZFS", "subtitle": "The smartest reliable filesystem", "imageName": "@@folder"})

<main>
<div class="column1">
@@include('../../dist/@@folder/first-side/column1.html')
</div>
<div class="column2">
@@include('../../dist/@@folder/first-side/column2.html')
</div>
</main>

@@include('../../dist/common/footer.html', {"class": "print-only"})


</div>

<hr class="no-print"/>

<div class="reverse">
@@include('../../dist/common/reverse/header.html', {"title": "OpenZFS", "imageName": "@@folder"})

<main>
<div class="column1">
@@include('../../dist/@@folder/reverse/column1.html')
</div>
<div class="column2">
@@include('../../dist/@@folder/reverse/column2.html')
</div>
</main>

@@include('../../dist/common/footer.html')
</div>

<script src="../common/lib/highlight.pack.js"></script>
<script src="../common/script.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions src/openzfs/openzfs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* put your all custom css rules here */
/* you must not change other scss files */

body {
// available colors are: blue, green, purple, orange and grey
--currentColor: var(--orange);

main div {
img {
height: 230px;
}
}
}
39 changes: 39 additions & 0 deletions src/openzfs/reverse/column1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# zfs – configure ZFS snapshots

___A snapshot is a read-only copy of a file system.___

_File system snapshots can be accessed under the .zfs/snapshot directory in the root of the file system._

List snapshots
`zfs list -t snapshot`

Create a snapshot
`zfs snapshot <pool>/<dataset>@<snapshot>`

Rollback a snapshot
`zfs rollback <pool>/<dataset>@<snapshot>`

Remove a snapshot
`zfs destroy <pool>/<dataset>@<snapshot>`

Remove a snapshot and his descendent snapshots
`zfs destroy -r <pool>/<dataset>@<snapshot>`


# zfs – configure ZFS CLONES

___A clone is a writable volume or file system whose initial contents are the same as the original dataset.___

Create a clone
`zfs clone <snapshot> <filesystem>|<volume>`


# zfs – configure backup and restore

___ZFS implements data protection feature___

Backup a snapshot in a file
`zfs send <pool>/<dataset>@<snapshot> > <file>`

Restore a file system from a file
`zfs recv <pool>/<dataset> < <file>`
34 changes: 34 additions & 0 deletions src/openzfs/reverse/column2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Perform increment backup in a file
`zfs send -i <snapshot_n> <snapshot_n+1> > <file>`

Perform differential backup in a file
`zfs send -I <snapshot_n> <snapshot_n+p> > <file>`

Duplicate a snapshot as a new file system
`zfs send <pool>/<dataset>@<snapshot> | zfs recv <pool>/<other_dataset>`

Duplicate a snapshot on a different host
`zfs send <pool>/<dataset>@<snapshot> | ssh <host> zfs recv <pool>/<dataset>`


# zfs – set ZFS file systems properties #####

___Properties control ZFS behaviour.___

List properties of a dataset
`zfs get all <pool>/<dataset>`

Create a NFS share
`zfs set sharenfs=on <pool>/<dataset>`

Activate compression
`zfs set compression=gzip <pool>/<dataset>`

Activate encryption (only at the creation of the dataset), with Oracle ZFS
`zfs create -o encryption=on <pool>/<dataset>`

Activate read-only mode
`zfs set readonly=on <pool>/<dataset>`

Prevent executing from within this file system
`zfs set exec=off <pool_name>/<dataset_name>`

0 comments on commit 943b7bb

Please sign in to comment.