17.6 C
Jaipur
Thursday, December 2, 2021

How to check ZFS File system storage pool on Linux/Unix

Must read

First, there is no fsck command for ZFS, which Linux and Unix use for file system repair. However, ZFS comes with a scrub option. This subcommand is a root-initiated dynamic consistency check. It runs in the background on a mounted live filesystem. Hence, we use the zpool scrub command for ZFS storage and test file system integrity. Let us see how to check ZFS File system storage pool on Linux, FreeBSD or Unix-like systems using the command-line option.

ZFS scrubbing option examines all data to discover silent errors due to hardware faults or disk failure.

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements zpool command on Linux/Unix
Est. reading time 3 minutes

Checking ZFS File system storage pool integrity

The procedure is as follows:

  1. Open the terminal application.
  2. For remote server use the ssh command.
  3. Login as root user using the su command or sudo command.
  4. The syntax to check data integrity is to initiate an explicit scrubbing of all the pools. So run:
    zpool scrub pool_name_here
  5. See the current health status for the given ZFS storage:
    zpool status -v pool_name_here

Please note that ZFS scrubbing and resilvering are I/O-intensive operations. Hence, ZFS only allows one scrub option at a time.

How to find your ZFS File system storage pools

To lists ZFS storage pools along with a health status and space, run:
# zpool list
My Linux ZFS storage pool:


NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
lxdzfs   127G  8.49G   119G        -         -     5%     6%  1.00x    ONLINE  -

OR you can use the following command:
# zpool status

How do I test a ZFS file system for errors?

Let us start a scrub (check zfs for errors and other stuff) for a pool named zroot:
# zpool scrub zroot

Test a ZFS file system for errors

We can wait until scrub has completed before returning by passing the -w:
# zpool scrub -w zroot

Patreon supporters only guides 🤓

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare
  • Join my Patreon to support independent content creators and start reading latest guides:

Join Patreon

Stop scrubbing command

The syntax is:
# zpool scrub -s {pool}
# zpool scrub -s zroot

Pause scrubbing

Try passing the -p option as follows:
# zpool scrub -p {pool}
# zpool scrub -p zroot

When a scrub is paused, the zpool scrub command agsin resumes it. For example:
# zpool scrub zroot

Checking ZFS File system storage pool status

The zpool status command reports the progress of the scrub and summarizes the results of the scrub upon completion. The syntax is:
# zpool status -v
# zpool status -v {pool}
# zpool status -v zroot

Look for the scan line. Here is a sample outputs indicating active scan from my FreeBSD 13 box:


  scan: scrub in progress since Tue Oct 19 12:11:45 2021
	162G scanned at 27.0G/s, 1.10M issued at 188K/s, 1.13T total
	0B repaired, 0.00% done, no estimated completion time

The -v option shows verbose data error information, printing out a complete list of all data errors since the last complete pool scrub.


  pool: zroot
 state: ONLINE
  scan: scrub repaired 0B in 00:24:44 with 0 errors on Mon May 17 03:28:34 2021
config:

	NAME            STATE     READ WRITE CKSUM
	zroot           ONLINE       0     0     0
	  raidz1-0      ONLINE       0     0     0
	    ada0p3.eli  ONLINE       0     0     0
	    ada1p3.eli  ONLINE       0     0     0
	    ada3p3.eli  ONLINE       0     0     0

errors: No known data errors


What is ZFS resilver command?

A resilver is an automatic dynamic consistency restoration run after a disk or network failure or slowdown of one or more mirrors. The syntax is:
sudo zpool resilver {pool}

Summing up

You learned how to test ZFS for hardware errors and ZFS file system integrity. Make sure you read zfs man pages online here or at the CLI using the man command as follows:
man zpool
# freebsd
man zpool-status
man zpool-scrub
man zpool-resilver


ADVERTISEMENT

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest article