ZFS nice commands: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "</source" to "</syntaxhighlight")
m (Text replacement - "[[Kategorie:" to "[[Category:")
Line 1: Line 1:
[[Kategorie:ZFS]]
[[Category:ZFS]]


=Some ZFS commands I use often (on Linux)=
=Some ZFS commands I use often (on Linux)=

Revision as of 00:56, 26 November 2021


Some ZFS commands I use often (on Linux)

zpool

Get zpool status

<source lang=bash>

  1. 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>

  1. 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>

  1. 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>

  1. 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>

  1. echo $[ 2 ** 12 ]

4096

  1. zpool set ashift=12 rpool

</syntaxhighlight>

<source lang=bash>

  1. 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>

  1. 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>