ZFS nice commands: Difference between revisions
(Die Seite wurde neu angelegt: „Kategorie:ZFS =Some ZFS commands I use often (on Linux)= ==zpool== ===Get zpool status=== <source lang=bash> # zpool status -P pool: rpool state: ONLI…“) |
m (Text replacement - "</source" to "</syntaxhighlight") |
||
Line 15: | Line 15: | ||
rpool ONLINE 0 0 0 | rpool ONLINE 0 0 0 | ||
/dev/disk/by-id/ata-SanDisk_SDSSDHII960G_151740411091-part4 ONLINE 0 0 0 | /dev/disk/by-id/ata-SanDisk_SDSSDHII960G_151740411091-part4 ONLINE 0 0 0 | ||
</ | </syntaxhighlight> | ||
* -P : Display real paths for vdevs instead of only the last component of the path. | * -P : Display real paths for vdevs instead of only the last component of the path. | ||
<source lang=bash> | <source lang=bash> | ||
Line 29: | Line 29: | ||
errors: No known data errors | errors: No known data errors | ||
</ | </syntaxhighlight> | ||
* -P : Display real paths for vdevs instead of only the last component of the path. | * -P : Display real paths for vdevs instead of only the last component of the path. | ||
* -L : Display real paths for vdevs resolving all symbolic links. | * -L : Display real paths for vdevs resolving all symbolic links. | ||
Line 37: | Line 37: | ||
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT | NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT | ||
rpool 788G 609G 179G - 53% 77% 1.00x ONLINE - | rpool 788G 609G 179G - 53% 77% 1.00x ONLINE - | ||
</ | </syntaxhighlight> | ||
Ooooh... bad fragmentation! So what? It's a SSD! | Ooooh... bad fragmentation! So what? It's a SSD! | ||
Line 45: | Line 45: | ||
NAME ASHIFT | NAME ASHIFT | ||
rpool 9 | rpool 9 | ||
</ | </syntaxhighlight> | ||
which means 2^9=512 := 512 byte blocks in the backend... that is uncool for SSDs. | which means 2^9=512 := 512 byte blocks in the backend... that is uncool for SSDs. | ||
<source lang=bash> | <source lang=bash> | ||
Line 52: | Line 52: | ||
# zpool set ashift=12 rpool | # zpool set ashift=12 rpool | ||
</ | </syntaxhighlight> | ||
<source lang=bash> | <source lang=bash> | ||
Line 58: | Line 58: | ||
NAME ASHIFT | NAME ASHIFT | ||
rpool 12 | rpool 12 | ||
</ | </syntaxhighlight> | ||
which means 2^12=4096 := 4k blocks in the backend. Perfect! | which means 2^12=4096 := 4k blocks in the backend. Perfect! | ||
Line 83: | Line 83: | ||
additional, non-pointer bps of type 0: 237576 | additional, non-pointer bps of type 0: 237576 | ||
Dittoed blocks on same vdev: 1230844 | Dittoed blocks on same vdev: 1230844 | ||
</ | </syntaxhighlight> |
Revision as of 15:28, 25 November 2021
Some ZFS commands I use often (on Linux)
zpool
Get zpool status
<source lang=bash>
- zpool status -P
pool: rpool state: ONLINE scan: scrub repaired 0B in 0h41m with 0 errors on Tue Nov 27 11:49:30 2018
config:
NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 /dev/disk/by-id/ata-SanDisk_SDSSDHII960G_151740411091-part4 ONLINE 0 0 0 </syntaxhighlight>
- -P : Display real paths for vdevs instead of only the last component of the path.
<source lang=bash>
- zpool status -PL
pool: rpool state: ONLINE scan: scrub repaired 0B in 0h41m with 0 errors on Tue Nov 27 11:49:30 2018
config:
NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 /dev/sda4 ONLINE 0 0 0
errors: No known data errors </syntaxhighlight>
- -P : Display real paths for vdevs instead of only the last component of the path.
- -L : Display real paths for vdevs resolving all symbolic links.
Get zpool size
<source lang=bash>
- zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT rpool 788G 609G 179G - 53% 77% 1.00x ONLINE - </syntaxhighlight> Ooooh... bad fragmentation! So what? It's a SSD!
Get the ashift value
<source lang=bash>
- zpool list -o name,ashift
NAME ASHIFT rpool 9 </syntaxhighlight> which means 2^9=512 := 512 byte blocks in the backend... that is uncool for SSDs. <source lang=bash>
- echo $[ 2 ** 12 ]
4096
- zpool set ashift=12 rpool
</syntaxhighlight>
<source lang=bash>
- zpool list -o name,ashift
NAME ASHIFT rpool 12 </syntaxhighlight> which means 2^12=4096 := 4k blocks in the backend. Perfect!
zfs
zdb
Traverse all blocks
<source lang=bash>
- zdb -b rpool
Traversing all blocks to verify nothing leaked ...
loading space map for vdev 0 of 1, metaslab 196 of 197 ...
609G completed (4928MB/s) estimated time remaining: 0hr 00min 00sec
No leaks (block sum matches space maps exactly)
bp count: 32920989 ganged count: 0 bp logical: 760060348928 avg: 23087 bp physical: 650570102784 avg: 19761 compression: 1.17 bp allocated: 654308115456 avg: 19875 compression: 1.16 bp deduped: 0 ref>1: 0 deduplication: 1.00 SPA allocated: 654308115456 used: 77.33%
additional, non-pointer bps of type 0: 237576 Dittoed blocks on same vdev: 1230844 </syntaxhighlight>