stm / [WIP] ZFS commands

Last active 2 hours ago

Like 0

Commands to create new ZFS pool and datasets on Linux

stm revised this gist 2 hours ago · 9071edc

1 file changed, 4 insertions, 2 deletions

zfs.txt
@@ -32,8 +32,10 @@ zpool create \
32 32 -O normalization=formD \
33 33 -O relatime=on \
34 34 -O longname=on \
35 - -O canmount=off -O mountpoint=/${NAME} \
36 - ${NAME} ${DISK1..N} raidz2
35 + -O canmount=off \
36 + -O mountpoint=/mnt/${NAME} ${NAME} \
37 + raidz2 \
38 + ${DISK1..N}
37 39
38 40
39 41 # Dataset creation

stm revised this gist 6 hours ago · f19b43e

1 file changed, 5 insertions, 3 deletions

zfs.txt
@@ -1,4 +1,7 @@
1 1 # RAIDZ2 pool creation
2 + #
3 + # -o (lowercase) is a _pool_ setting, -O (uppercase) is a _root dataset_ setting
4 + #
2 5 # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB)
3 6 # autotrim: TRIM for SSDs
4 7 # encryption=on: Defaults to aes-256-gcm (since 0.8.4)
@@ -8,10 +11,9 @@
8 11 # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only
9 12 # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0)
10 13 # direct: Unset, defaulting to always (since 2.2.0)
11 - # !!! recordsize: Unset, defaulting to 128KiB
12 - #
14 + # !!! recordsize: Unset, defaulting to 128KiB (important performance related setting!)
13 15 #
14 - # Sources:
16 + # Sources:
15 17 # https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Trixie%20Root%20on%20ZFS.html#step-2-disk-formatting
16 18 # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#compression
17 19 # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#direct

stm revised this gist 7 hours ago · ed08292

1 file changed, 38 insertions

zfs.txt (file created)
@@ -0,0 +1,38 @@
1 + # RAIDZ2 pool creation
2 + # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB)
3 + # autotrim: TRIM for SSDs
4 + # encryption=on: Defaults to aes-256-gcm (since 0.8.4)
5 + # pbkdf2iters=700000: Double the default PBKDF2-SHA1(?) iterations, default is 350000
6 + # dnodesize=auto: Is supposed to be used on systems running SAMBA with xattr=sa
7 + # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`)
8 + # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only
9 + # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0)
10 + # direct: Unset, defaulting to always (since 2.2.0)
11 + # !!! recordsize: Unset, defaulting to 128KiB
12 + #
13 + #
14 + # Sources:
15 + # https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Trixie%20Root%20on%20ZFS.html#step-2-disk-formatting
16 + # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#compression
17 + # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#direct
18 + # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#dnodesize
19 + # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#longname
20 + # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#pbkdf2iters
21 + #
22 + #
23 + zpool create \
24 + -o ashift=12 \
25 + -o autotrim=on \
26 + -O encryption=on -O keylocation=prompt -O keyformat=passphrase \
27 + -O pbkdf2iters=700000 \
28 + -O acltype=posixacl -O xattr=sa -O dnodesize=auto \
29 + -O compression=on \
30 + -O normalization=formD \
31 + -O relatime=on \
32 + -O longname=on \
33 + -O canmount=off -O mountpoint=/${NAME} \
34 + ${NAME} ${DISK1..N} raidz2
35 +
36 +
37 + # Dataset creation
38 + TODO