| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#dnodesize | |
| 22 | 22 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#longname | |
| 23 | 23 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#pbkdf2iters | |
| 24 | + | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#xattr | |
| 24 | 25 | # | |
| 25 | 26 | ||
| 26 | 27 | ||
| @@ -36,7 +37,7 @@ zpool create \ | |||
| 36 | 37 | -O acltype=posixacl -O xattr=sa -O dnodesize=auto \ | |
| 37 | 38 | -O compression=on \ | |
| 38 | 39 | -O normalization=formD \ | |
| 39 | - | -O relatime=on \ | |
| 40 | + | -O atime=off \ | |
| 40 | 41 | -O longname=on \ | |
| 41 | 42 | -O canmount=off \ | |
| 42 | 43 | -O mountpoint=/mnt/$${POOL_NAME} ${POOL_NAME} \ | |
| @@ -72,7 +73,7 @@ zfs create -o recordsize=4M ${POOL_NAME}/recordsize-test/4M | |||
| 72 | 73 | # Dataset creation (media, file server) | |
| 73 | 74 | # | |
| 74 | 75 | # casesensitivity=insensitive: Can speed up SAMBA sorting due to SAMBA being case-insensitive as well | |
| 75 | - | # recordsize=XXX Bigger recordsize can yield higher compression rations (if data is suitable; video files aren't) | |
| 76 | + | # recordsize=XXX Bigger recordsize can yield higher compression ratios (if data is suitable; video files aren't) | |
| 76 | 77 | # | |
| 77 | 78 | TODO | |
| 78 | 79 | ||
stm / [WIP] ZFS commands
Last active 1 month ago
Commands to create new ZFS pool and datasets on Linux
stm revised this gist 1 month ago · eb76af0
1 file changed, 3 insertions, 2 deletions
stm revised this gist 1 month ago · 97878a7
1 file changed, 32 insertions, 4 deletions
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | # encryption=on: Defaults to aes-256-gcm (since 0.8.4) | |
| 6 | 6 | # pbkdf2iters=1400000: PBKDF2-SHA1 iterations recommendation by OWASP, default is only 350000 | |
| 7 | 7 | # dnodesize=auto: Is supposed to be used on systems running SAMBA with xattr=sa | |
| 8 | - | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 8 | + | # compression=on: Defaults to lz4 | |
| 9 | 9 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
| 10 | 10 | # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0) | |
| 11 | 11 | # primarycache: Defines what is cached in ARC, defaults to all (alternative settings: none, metadata) | |
| @@ -39,20 +39,48 @@ zpool create \ | |||
| 39 | 39 | -O relatime=on \ | |
| 40 | 40 | -O longname=on \ | |
| 41 | 41 | -O canmount=off \ | |
| 42 | - | -O mountpoint=/mnt/${NAME} ${NAME} \ | |
| 42 | + | -O mountpoint=/mnt/$${POOL_NAME} ${POOL_NAME} \ | |
| 43 | 43 | raidz2 \ | |
| 44 | 44 | ${DISK1..N} | |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | - | # Dataset creation (media) | |
| 47 | + | # Dataset creation (benchmarking) | |
| 48 | 48 | # | |
| 49 | - | # Bigger record sizes benefit from better compression ratios (in theory; video files are already highly compressed) | |
| 49 | + | # To evaluate which recordsize is most suitable for a certain task we want to hit the raw disk as much as possible. | |
| 50 | + | # Modern OpenZFS versions already allow for direct IO (direct=standard by default), which mostly bypasses ARC/L2ARC. | |
| 51 | + | # In addition we tell ZFS to not hold actual file data in cache, only metadata. | |
| 52 | + | # | |
| 53 | + | zfs create \ | |
| 54 | + | -o canmount=off \ | |
| 55 | + | -o casesensitivity=insensitive \ | |
| 56 | + | -o primarycache=metadata \ | |
| 57 | + | -o secondarycache=metadata \ | |
| 58 | + | ${POOL_NAME}/recordsize-test | |
| 59 | + | zfs create -o recordsize=4K ${POOL_NAME}/recordsize-test/4K | |
| 60 | + | zfs create -o recordsize=8K ${POOL_NAME}/recordsize-test/8K | |
| 61 | + | zfs create -o recordsize=16K ${POOL_NAME}/recordsize-test/16K | |
| 62 | + | zfs create -o recordsize=32K ${POOL_NAME}/recordsize-test/32K | |
| 63 | + | zfs create -o recordsize=64K ${POOL_NAME}/recordsize-test/64K | |
| 64 | + | zfs create -o recordsize=128K ${POOL_NAME}/recordsize-test/128K | |
| 65 | + | zfs create -o recordsize=256K ${POOL_NAME}/recordsize-test/256K | |
| 66 | + | zfs create -o recordsize=512K ${POOL_NAME}/recordsize-test/512K | |
| 67 | + | zfs create -o recordsize=1M ${POOL_NAME}/recordsize-test/1M | |
| 68 | + | zfs create -o recordsize=2M ${POOL_NAME}/recordsize-test/2M | |
| 69 | + | zfs create -o recordsize=4M ${POOL_NAME}/recordsize-test/4M | |
| 70 | + | ||
| 71 | + | ||
| 72 | + | # Dataset creation (media, file server) | |
| 73 | + | # | |
| 74 | + | # casesensitivity=insensitive: Can speed up SAMBA sorting due to SAMBA being case-insensitive as well | |
| 75 | + | # recordsize=XXX Bigger recordsize can yield higher compression rations (if data is suitable; video files aren't) | |
| 50 | 76 | # | |
| 51 | 77 | TODO | |
| 52 | 78 | ||
| 79 | + | ||
| 53 | 80 | # Dataset creation (databases) | |
| 54 | 81 | # | |
| 55 | 82 | # Common database solutions use 4K (SQLite), 8K (PostgreSQL) or 16KB (MariaDB InnoDB) page sizes. | |
| 56 | 83 | # Adjusting recordsize to these workloads reduces write amplification and improves random IO. | |
| 84 | + | # Databases usually implement some form of caching themselves, so consider disabling ARC/L2ARC file caching. | |
| 57 | 85 | # | |
| 58 | 86 | TODO | |
stm revised this gist 1 month ago · 78743a7
1 file changed, 18 insertions, 5 deletions
| @@ -1,6 +1,4 @@ | |||
| 1 | - | # RAIDZ2 pool creation | |
| 2 | - | # | |
| 3 | - | # -o (lowercase) is a _pool_ setting, -O (uppercase) is a _root dataset_ setting | |
| 1 | + | # Notes | |
| 4 | 2 | # | |
| 5 | 3 | # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB) | |
| 6 | 4 | # autotrim=on: TRIM for SSDs | |
| @@ -24,6 +22,11 @@ | |||
| 24 | 22 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#longname | |
| 25 | 23 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#pbkdf2iters | |
| 26 | 24 | # | |
| 25 | + | ||
| 26 | + | ||
| 27 | + | # RAIDZ2 pool creation | |
| 28 | + | # | |
| 29 | + | # -o (lowercase) is a _pool_ setting, -O (uppercase) is a _root dataset_ setting | |
| 27 | 30 | # | |
| 28 | 31 | zpool create \ | |
| 29 | 32 | -o ashift=12 \ | |
| @@ -41,5 +44,15 @@ zpool create \ | |||
| 41 | 44 | ${DISK1..N} | |
| 42 | 45 | ||
| 43 | 46 | ||
| 44 | - | # Dataset creation | |
| 45 | - | TODO | |
| 47 | + | # Dataset creation (media) | |
| 48 | + | # | |
| 49 | + | # Bigger record sizes benefit from better compression ratios (in theory; video files are already highly compressed) | |
| 50 | + | # | |
| 51 | + | TODO | |
| 52 | + | ||
| 53 | + | # Dataset creation (databases) | |
| 54 | + | # | |
| 55 | + | # Common database solutions use 4K (SQLite), 8K (PostgreSQL) or 16KB (MariaDB InnoDB) page sizes. | |
| 56 | + | # Adjusting recordsize to these workloads reduces write amplification and improves random IO. | |
| 57 | + | # | |
| 58 | + | TODO | |
stm revised this gist 1 month ago · a032e43
1 file changed, 1 insertion, 1 deletion
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB) | |
| 6 | 6 | # autotrim=on: TRIM for SSDs | |
| 7 | 7 | # encryption=on: Defaults to aes-256-gcm (since 0.8.4) | |
| 8 | - | # pbkdf2iters=1400000: PBKDF2-SHA1(?) iterations recommendation by OWASP, default is only 350000 | |
| 8 | + | # pbkdf2iters=1400000: PBKDF2-SHA1 iterations recommendation by OWASP, default is only 350000 | |
| 9 | 9 | # dnodesize=auto: Is supposed to be used on systems running SAMBA with xattr=sa | |
| 10 | 10 | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 11 | 11 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
stm revised this gist 1 month ago · 43f34e1
1 file changed, 1 insertion, 1 deletion
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 11 | 11 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
| 12 | 12 | # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0) | |
| 13 | - | # primarycache: Defines what is cached in ARC , defaults to all (alternative settings: none, metadata) | |
| 13 | + | # primarycache: Defines what is cached in ARC, defaults to all (alternative settings: none, metadata) | |
| 14 | 14 | # secondarycache: Defines what is cached in L2ARC, defaults to all (alternative settings: none, metadata) | |
| 15 | 15 | # direct: Unset, defaulting to standard (since 2.3.0) | |
| 16 | 16 | # !!! recordsize: Unset, defaulting to 128KiB (important performance related setting!) | |
stm revised this gist 1 month ago · 8ab61e9
1 file changed, 3 insertions, 1 deletion
| @@ -3,13 +3,15 @@ | |||
| 3 | 3 | # -o (lowercase) is a _pool_ setting, -O (uppercase) is a _root dataset_ setting | |
| 4 | 4 | # | |
| 5 | 5 | # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB) | |
| 6 | - | # autotrim: TRIM for SSDs | |
| 6 | + | # autotrim=on: TRIM for SSDs | |
| 7 | 7 | # encryption=on: Defaults to aes-256-gcm (since 0.8.4) | |
| 8 | 8 | # pbkdf2iters=1400000: PBKDF2-SHA1(?) iterations recommendation by OWASP, default is only 350000 | |
| 9 | 9 | # dnodesize=auto: Is supposed to be used on systems running SAMBA with xattr=sa | |
| 10 | 10 | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 11 | 11 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
| 12 | 12 | # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0) | |
| 13 | + | # primarycache: Defines what is cached in ARC , defaults to all (alternative settings: none, metadata) | |
| 14 | + | # secondarycache: Defines what is cached in L2ARC, defaults to all (alternative settings: none, metadata) | |
| 13 | 15 | # direct: Unset, defaulting to standard (since 2.3.0) | |
| 14 | 16 | # !!! recordsize: Unset, defaulting to 128KiB (important performance related setting!) | |
| 15 | 17 | # | |
stm revised this gist 1 month ago · d03bf0b
1 file changed, 3 insertions, 2 deletions
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | # ashift=12: 2^12 = 4KiB sectors, for certain NVMe drives use 13 (8KiB) | |
| 6 | 6 | # autotrim: TRIM for SSDs | |
| 7 | 7 | # encryption=on: Defaults to aes-256-gcm (since 0.8.4) | |
| 8 | - | # pbkdf2iters=700000: Double the default PBKDF2-SHA1(?) iterations, default is 350000 | |
| 8 | + | # pbkdf2iters=1400000: PBKDF2-SHA1(?) iterations recommendation by OWASP, default is only 350000 | |
| 9 | 9 | # dnodesize=auto: Is supposed to be used on systems running SAMBA with xattr=sa | |
| 10 | 10 | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 11 | 11 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | # !!! recordsize: Unset, defaulting to 128KiB (important performance related setting!) | |
| 15 | 15 | # | |
| 16 | 16 | # Sources: | |
| 17 | + | # https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#pbkdf2 | |
| 17 | 18 | # https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Trixie%20Root%20on%20ZFS.html#step-2-disk-formatting | |
| 18 | 19 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#compression | |
| 19 | 20 | # https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html#direct | |
| @@ -26,7 +27,7 @@ zpool create \ | |||
| 26 | 27 | -o ashift=12 \ | |
| 27 | 28 | -o autotrim=on \ | |
| 28 | 29 | -O encryption=on -O keylocation=prompt -O keyformat=passphrase \ | |
| 29 | - | -O pbkdf2iters=700000 \ | |
| 30 | + | -O pbkdf2iters=1400000 \ | |
| 30 | 31 | -O acltype=posixacl -O xattr=sa -O dnodesize=auto \ | |
| 31 | 32 | -O compression=on \ | |
| 32 | 33 | -O normalization=formD \ | |
stm revised this gist 1 month ago · 0bff9fd
1 file changed, 1 insertion, 1 deletion
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | # compression=on: Defaults to lz4 (when lz4_compress is enabled, see `zpool get feature@lz4_compress ${NAME}`) | |
| 11 | 11 | # normalization=formD: Decomposed Unicode normalization, implies utf8only=on, so UTF-8 filenames only | |
| 12 | 12 | # longname=on: Allows filenames up to 1023 bytes, default is off meaning 255 bytes (supported since 2.3.0) | |
| 13 | - | # direct: Unset, defaulting to always (since 2.2.0) | |
| 13 | + | # direct: Unset, defaulting to standard (since 2.3.0) | |
| 14 | 14 | # !!! recordsize: Unset, defaulting to 128KiB (important performance related setting!) | |
| 15 | 15 | # | |
| 16 | 16 | # Sources: | |
stm revised this gist 2 months ago · 9071edc
1 file changed, 4 insertions, 2 deletions
| @@ -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 2 months ago · f19b43e
1 file changed, 5 insertions, 3 deletions
| @@ -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 | |