commit 147445dfb635253686992f5f771a12513da10820
parent cf17ee0af9362351972dcb87fceefa28f7923dda
Author: pyratebeard <root@pyratebeard.net>
Date: Mon, 9 Jun 2025 10:45:18 +0100
updates
Diffstat:
1 file changed, 54 insertions(+), 5 deletions(-)
diff --git a/filesystems/zfs.md b/filesystems/zfs.md
@@ -1,11 +1,60 @@
# zfs
## common commands
-| command | description |
-| --- | --- |
-| `zfs list` | view existing datasets |
-| `zfs load-key` | load encryption key |
-| `zpool scrub -p <pool>` | pause scrub |
+| command | description |
+| --- | --- |
+| `zfs list` | view existing datasets |
+| `zfs load-key` | load encryption key |
+| `zfs create` | create new mount point |
+| `zfs history` | show complete history of pool |
+| `zpool scrub -p <pool>` | pause scrub |
## freebsd
* `zfs` installed as part of base from 13.0
+
+## my custom setup
+* 4x10T disks, one pool with two mirrors
+ * gives ~20T usable storage
+* prep disks
+```
+wipefs -a /dev/<disk>
+parted /dev/<disk> mklabel gpt
+parted /dev/<disk> mkpart "<custom id>" zfs 0% 100%
+```
+
+The `custom id` shows in ZFS, i use a location identifier as below
+* 2 character server prefix, `kk` for `kinakuta`
+* 2 character enclosure identifier, `e0`, `e1`, etc.
+* 2 character disk positon (in my case top to bottom), `d0`, `d1`, etc.
+* serial number of the physical disk, taken from the label
+
+For example
+```
+root@kinakuta:~# zpool status ~
+ pool: crypt.kk
+ state: ONLINE
+ scan: scrub repaired 0B in 16:50:21 with 0 errors on Tue Apr 15 07:57:21 2025
+config:
+
+ NAME STATE READ WRITE CKSUM
+ crypt.kk ONLINE 0 0 0
+ mirror-0 ONLINE 0 0 0
+ kke0d0-ZS518A9F ONLINE 0 0 0
+ kke0d1-ZS518A21 ONLINE 0 0 0
+ mirror-1 ONLINE 0 0 0
+ kke1d0-ZS518A9D ONLINE 0 0 0
+ kke1d1-ZS518A76 ONLINE 0 0 0
+
+errors: No known data errors
+```
+
+Create zpool
+```
+zpool create -f -o ashift=12 -o feature@encryption=enabled -O encryption=on -O keylocation=prompt -O keyformat=passphrase -m /path/to/mountpoint <zpool name> mirror /dev/disk/by-partlabel/kke0d0-ZS518A9F /dev/disk/by-partlabel/
+kke0d1-ZS518A21 mirror /dev/disk/by-partlabel/kke1d0-ZS518A9D /dev/disk/by-partlabel/kke1d1-ZS518A76
+```
+
+To add spares after pool creation prep them as before then incant
+```
+zpool add <zpool name> spare /dev/disk/by-partlabel/<part id>
+```