mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Reconcile ZFS pool names for all examples and remove some garbage (#4868)
This commit is contained in:
parent
4273e67f56
commit
111033f742
@ -3,6 +3,7 @@ category: tool
|
|||||||
tool: zfs
|
tool: zfs
|
||||||
contributors:
|
contributors:
|
||||||
- ["sarlalian", "http://github.com/sarlalian"]
|
- ["sarlalian", "http://github.com/sarlalian"]
|
||||||
|
- ["A1EF", "https://github.com/A1EF"]
|
||||||
filename: LearnZfs.txt
|
filename: LearnZfs.txt
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -25,7 +26,6 @@ RAID setup with ZFS, as ZFS expects to directly manage the underlying disks.
|
|||||||
|
|
||||||
Types of VDEV's
|
Types of VDEV's
|
||||||
|
|
||||||
* stripe (a single disk, no redundancy)
|
|
||||||
* mirror (n-way mirrors supported)
|
* mirror (n-way mirrors supported)
|
||||||
* raidz
|
* raidz
|
||||||
* raidz1 (1-disk parity, similar to RAID 5)
|
* raidz1 (1-disk parity, similar to RAID 5)
|
||||||
@ -71,7 +71,7 @@ List zpools
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create a raidz zpool
|
# Create a raidz zpool
|
||||||
$ zpool create bucket raidz1 gpt/zfs0 gpt/zfs1 gpt/zfs2
|
$ zpool create zroot raidz1 gpt/zfs0 gpt/zfs1 gpt/zfs2
|
||||||
|
|
||||||
# List ZPools
|
# List ZPools
|
||||||
$ zpool list
|
$ zpool list
|
||||||
@ -160,22 +160,22 @@ Create datasets
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create dataset
|
# Create dataset
|
||||||
$ zfs create tank/root/data
|
$ zfs create zroot/root/data
|
||||||
$ mount | grep data
|
$ mount | grep data
|
||||||
tank/root/data on /data (zfs, local, nfsv4acls)
|
zroot/root/data on /data (zfs, local, nfsv4acls)
|
||||||
|
|
||||||
# Create child dataset
|
# Create child dataset
|
||||||
$ zfs create tank/root/data/stuff
|
$ zfs create zroot/root/data/stuff
|
||||||
$ mount | grep data
|
$ mount | grep data
|
||||||
tank/root/data on /data (zfs, local, nfsv4acls)
|
zroot/root/data on /data (zfs, local, nfsv4acls)
|
||||||
tank/root/data/stuff on /data/stuff (zfs, local, nfsv4acls)
|
zroot/root/data/stuff on /data/stuff (zfs, local, nfsv4acls)
|
||||||
|
|
||||||
|
|
||||||
# Create Volume
|
# Create Volume
|
||||||
$ zfs create -V zroot/win_vm
|
$ zfs create -V zroot/win_vm
|
||||||
$ zfs list zroot/win_vm
|
$ zfs list zroot/win_vm
|
||||||
NAME USED AVAIL REFER MOUNTPOINT
|
NAME USED AVAIL REFER MOUNTPOINT
|
||||||
tank/win_vm 4.13G 17.9G 64K -
|
zroot/win_vm 4.13G 17.9G 64K -
|
||||||
```
|
```
|
||||||
|
|
||||||
List datasets
|
List datasets
|
||||||
@ -213,28 +213,28 @@ zroot/var/tmp@daily-2015-10-15
|
|||||||
Rename datasets
|
Rename datasets
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ zfs rename tank/root/home tank/root/old_home
|
$ zfs rename zroot/root/home zroot/root/old_home
|
||||||
$ zfs rename tank/root/new_home tank/root/home
|
$ zfs rename zroot/root/new_home zroot/root/home
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete dataset
|
Delete dataset
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Datasets cannot be deleted if they have any snapshots
|
# Datasets cannot be deleted if they have any snapshots
|
||||||
$ zfs destroy tank/root/home
|
$ zfs destroy zroot/root/home
|
||||||
```
|
```
|
||||||
|
|
||||||
Get / set properties of a dataset
|
Get / set properties of a dataset
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Get all properties
|
# Get all properties
|
||||||
$ zfs get all zroot/usr/home │157 # Create Volume
|
$ zfs get all zroot/usr/home
|
||||||
NAME PROPERTY VALUE SOURCE │158 $ zfs create -V zroot/win_vm
|
NAME PROPERTY VALUE SOURCE
|
||||||
zroot/home type filesystem - │159 $ zfs list zroot/win_vm
|
zroot/home type filesystem -
|
||||||
zroot/home creation Mon Oct 20 14:44 2014 - │160 NAME USED AVAIL REFER MOUNTPOINT
|
zroot/home creation Mon Oct 20 14:44 2014 -
|
||||||
zroot/home used 11.9G - │161 tank/win_vm 4.13G 17.9G 64K -
|
zroot/home used 11.9G -
|
||||||
zroot/home available 94.1G - │162 ```
|
zroot/home available 94.1G -
|
||||||
zroot/home referenced 11.9G - │163
|
zroot/home referenced 11.9G -
|
||||||
zroot/home mounted yes -
|
zroot/home mounted yes -
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ NAME PROPERTY VALUE SOURCE
|
|||||||
zroot/home compression off default
|
zroot/home compression off default
|
||||||
|
|
||||||
# Set property on dataset
|
# Set property on dataset
|
||||||
$ zfs set compression=gzip-9 mypool/lamb
|
$ zfs set compression=lz4 zroot/lamb
|
||||||
|
|
||||||
# Get a set of properties from all datasets
|
# Get a set of properties from all datasets
|
||||||
$ zfs list -o name,quota,reservation
|
$ zfs list -o name,quota,reservation
|
||||||
@ -283,16 +283,16 @@ Create snapshots
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create a snapshot of a single dataset
|
# Create a snapshot of a single dataset
|
||||||
zfs snapshot tank/home/sarlalian@now
|
zfs snapshot zroot/home/sarlalian@now
|
||||||
|
|
||||||
# Create a snapshot of a dataset and its children
|
# Create a snapshot of a dataset and its children
|
||||||
$ zfs snapshot -r tank/home@now
|
$ zfs snapshot -r zroot/home@now
|
||||||
$ zfs list -t snapshot
|
$ zfs list -t snapshot
|
||||||
NAME USED AVAIL REFER MOUNTPOINT
|
NAME USED AVAIL REFER MOUNTPOINT
|
||||||
tank/home@now 0 - 26K -
|
zroot/home@now 0 - 26K -
|
||||||
tank/home/sarlalian@now 0 - 259M -
|
zroot/home/sarlalian@now 0 - 259M -
|
||||||
tank/home/alice@now 0 - 156M -
|
zroot/home/alice@now 0 - 156M -
|
||||||
tank/home/bob@now 0 - 156M -
|
zroot/home/bob@now 0 - 156M -
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -300,10 +300,10 @@ Destroy snapshots
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# How to destroy a snapshot
|
# How to destroy a snapshot
|
||||||
$ zfs destroy tank/home/sarlalian@now
|
$ zfs destroy zroot/home/sarlalian@now
|
||||||
|
|
||||||
# Delete a snapshot on a parent dataset and its children
|
# Delete a snapshot on a parent dataset and its children
|
||||||
$ zfs destroy -r tank/home/sarlalian@now
|
$ zfs destroy -r zroot/home/sarlalian@now
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -311,10 +311,10 @@ Renaming Snapshots
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Rename a snapshot
|
# Rename a snapshot
|
||||||
$ zfs rename tank/home/sarlalian@now tank/home/sarlalian@today
|
$ zfs rename zroot/home/sarlalian@now zroot/home/sarlalian@today
|
||||||
$ zfs rename tank/home/sarlalian@now today
|
$ zfs rename zroot/home/sarlalian@now today
|
||||||
|
|
||||||
$ zfs rename -r tank/home@now @yesterday
|
$ zfs rename -r zroot/home@now @yesterday
|
||||||
```
|
```
|
||||||
|
|
||||||
Accessing snapshots
|
Accessing snapshots
|
||||||
@ -328,26 +328,26 @@ Sending and Receiving
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Backup a snapshot to a file
|
# Backup a snapshot to a file
|
||||||
$ zfs send tank/home/sarlalian@now | gzip > backup_file.gz
|
$ zfs send zroot/home/sarlalian@now | gzip > backup_file.gz
|
||||||
|
|
||||||
# Send a snapshot to another dataset
|
# Send a snapshot to another dataset
|
||||||
$ zfs send tank/home/sarlalian@now | zfs recv backups/home/sarlalian
|
$ zfs send zroot/home/sarlalian@now | zfs recv backups/home/sarlalian
|
||||||
|
|
||||||
# Send a snapshot to a remote host
|
# Send a snapshot to a remote host
|
||||||
$ zfs send tank/home/sarlalian@now | ssh root@backup_server 'zfs recv tank/home/sarlalian'
|
$ zfs send zroot/home/sarlalian@now | ssh root@backup_server 'zfs recv zroot/home/sarlalian'
|
||||||
|
|
||||||
# Send full dataset with snapshots to new host
|
# Send full dataset with snapshots to new host
|
||||||
$ zfs send -v -R tank/home@now | ssh root@backup_server 'zfs recv tank/home'
|
$ zfs send -v -R zroot/home@now | ssh root@backup_server 'zfs recv zroot/home'
|
||||||
```
|
```
|
||||||
|
|
||||||
Cloning Snapshots
|
Cloning Snapshots
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone a snapshot
|
# Clone a snapshot
|
||||||
$ zfs clone tank/home/sarlalian@now tank/home/sarlalian_new
|
$ zfs clone zroot/home/sarlalian@now zroot/home/sarlalian_new
|
||||||
|
|
||||||
# Promoting the clone so it is no longer dependent on the snapshot
|
# Promoting the clone so it is no longer dependent on the snapshot
|
||||||
$ zfs promote tank/home/sarlalian_new
|
$ zfs promote zroot/home/sarlalian_new
|
||||||
```
|
```
|
||||||
|
|
||||||
### Putting it all together
|
### Putting it all together
|
||||||
|
Loading…
Reference in New Issue
Block a user