blob: 760aeb143d7483932ef30a6f33b28eb4ad76a2be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
# 📘 ZFS Command Cheat Sheet
## 🛠️ Pool Management
### Create a Pool
```bash
zpool create <poolname> <device>
zpool create <poolname> mirror <dev1> <dev2>
zpool create <poolname> raidz1 <dev1> <dev2> <dev3> ...
```
### List Pools
```bash
zpool list
```
### Destroy a Pool
```bash
zpool destroy <poolname>
```
### Add Devices to a Pool
```bash
zpool add <poolname> <device>
```
### Export / Import Pool
```bash
zpool export <poolname>
zpool import <poolname>
zpool import -d /dev/disk/by-id <poolname>
```
## 🔍 Pool Status and Health
### Check Pool Status
```bash
zpool status
zpool status -v
```
### Scrub a Pool
```bash
zpool scrub <poolname>
```
### Clear Errors
```bash
zpool clear <poolname>
```
## 🧱 Dataset Management
### Create a Dataset
```bash
zfs create <poolname>/<dataset>
```
### List Datasets
```bash
zfs list
zfs list -t all
```
### Destroy a Dataset
```bash
zfs destroy <poolname>/<dataset>
```
## 📦 Mounting and Properties
### Set Mount Point
```bash
zfs set mountpoint=/your/path <poolname>/<dataset>
```
### Mount / Unmount
```bash
zfs mount <dataset>
zfs unmount <dataset>
```
### Auto Mount
```bash
zfs set canmount=on|off|noauto <dataset>
```
## 📝 Snapshots & Clones
### Create a Snapshot
```bash
zfs snapshot <poolname>/<dataset>@<snapshotname>
```
### List Snapshots
```bash
zfs list -t snapshot
```
### Roll Back to Snapshot
```bash
zfs rollback <poolname>/<dataset>@<snapshotname>
```
### Destroy a Snapshot
```bash
zfs destroy <poolname>/<dataset>@<snapshotname>
```
### Clone a Snapshot
```bash
zfs clone <poolname>/<dataset>@<snapshot> <poolname>/<new-dataset>
```
## 🔁 Sending & Receiving
### Send Snapshot to File or Pipe
```bash
zfs send <snapshot> > file
zfs send -R <snapshot> | zfs receive <pool>/<dataset>
```
### Receive Snapshot
```bash
zfs receive <pool>/<dataset>
```
## 🧮 Useful Info & Tuning
### Check Available Space
```bash
zfs list
```
### Set Quota or Reservation
```bash
zfs set quota=10G <dataset>
zfs set reservation=5G <dataset>
```
### Enable Compression
```bash
zfs set compression=lz4 <dataset>
```
### Enable Deduplication (use cautiously)
```bash
zfs set dedup=on <dataset>
```
---
> ✅ **Tip**: Always test ZFS commands in a safe environment before using them on production systems!
|