Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2017 16:18:01 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Is it needed/possible to fsck under ZFS ?
Message-ID:  <c9557aa9-5e82-0ba5-cdfc-f883c09f9b6d@FreeBSD.org>
In-Reply-To: <VI1PR02MB1200AEB4AB264455C7811D55F61B0@VI1PR02MB1200.eurprd02.prod.outlook.com>
References:  <VI1PR02MB1200AEB4AB264455C7811D55F61B0@VI1PR02MB1200.eurprd02.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--BdsCKoIPTq18eNodo6UnoMBc21vtVqjPq
Content-Type: multipart/mixed; boundary="F3mcFUadwJhVJjiHjSWujLj8rk4Ih5C94";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <c9557aa9-5e82-0ba5-cdfc-f883c09f9b6d@FreeBSD.org>
Subject: Re: Is it needed/possible to fsck under ZFS ?
References: <VI1PR02MB1200AEB4AB264455C7811D55F61B0@VI1PR02MB1200.eurprd02.prod.outlook.com>
In-Reply-To: <VI1PR02MB1200AEB4AB264455C7811D55F61B0@VI1PR02MB1200.eurprd02.prod.outlook.com>

--F3mcFUadwJhVJjiHjSWujLj8rk4Ih5C94
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 2017/04/20 14:42, Manish Jain wrote:
> Under UFS, I always used to do manual fsck upon improper shutdown.
> But I have no idea what to do for ZFS. Is it needed (even possible ?)
> to fsck for ZFS ? I very much doubt that : ZFS was, as far as I know,
> designed with data integrity as a central concern. But still I would
> like to be sure.

Other respondents have pointed you at 'zpool scrub' -- which is fine,
but it isn't an analogue of fsck(8).  'zpool scrub' discovers and
corrects filesystem blocks that fail their checksum tests (assuming some
sort of mirroring / zraid setup or you're saving multiple copies of each
block).  Failures like that are usually down to the hardware not working
perfectly.  It's a unique feature of ZFS -- about the only equivalents
are the 'patrol read' functionality of some high-end RAID controllers,
but those may only /detect/ corruption rather than fixing it.

Anyhow, you don't need anything like fsck(8) with ZFS because ZFS always
keeps what is on disk self-consistent.  It's the Copy-on-write semantics
thing that allows it to do that.  If you edit a file, the modified data
is first written to a new disk block, and then there is an atomic
operation to update the block pointer to point to the newly written
block.  If anything goes wrong in the middle of that sequence, you're
left with the original unchanged version of the file.

The difference effectively is that an unclean shutdown on ZFS may lose
the last few IO transactions, but the filesystem will still be clean and
should work immediately on reboot.  With UFS, you can end up with an
inconsistent filesystem due to interrupted IO transactions, which
requires a scan-and-repair pass by fsck and can result in files being
removed or moved into lost+found.

TL;DR -- don't worry about fsck with ZFS.  It doesn't need any special
treatment after an improper shutdown.

	Cheers,

	Matthew




--F3mcFUadwJhVJjiHjSWujLj8rk4Ih5C94--

--BdsCKoIPTq18eNodo6UnoMBc21vtVqjPq
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQJ8BAEBCgBmBQJY+NEvXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxOUYxNTRFQ0JGMTEyRTUwNTQ0RTNGMzAw
MDUxM0YxMEUwQTlFNEU3AAoJEABRPxDgqeTnHSwP/RdKUlpOiEtrTzPK5wQWmiu3
tDWKuy5o7AV8mhKOptY1LWOQAxnf4CghIdL3gwYxeC58NuInMH6Grt+S/XEXUhSv
G9sFox2DN1NBgxZIkTUOOssiPuKK9qqMj/SfpB+FEsy+cz+vGP3XDj08+6Kp4ZIT
9cZJoOUVuNQfqBzz6RoxHa0z2jjtgodRhfgE5h+TSJ0Qw7827o+XVlr4Uy3MrdEd
ugEoB99Gc4P6Y24CJ/mBNXyyPX58S6m9l4okJWuNMnwpTiQJG5973+4DpnV3smPr
pX2/vvlEVwKWArGrMQHTWxNzaEPL+oVB2kyrN0wzculxy/fHX0haNKgdZkxk8yDy
KX45SN1Uk2EnWSsT9XBeN4zwh9yW7Eo9C9NDbsmVu3k04iqASumREsjmCrFzOTAT
dF0dBajaw3DjIWsIrpbNs2Rm0hvl57itelhwUyivbwwjLe3na+kAr72VeoksAzlN
rW38uGUUq9/aVD0+nqD57Li4bKlZsW1/2wKJ3N1kHeEYUDDsHnkLKBwL/NS6WzwT
1pDQ1n9ffL62/Oeg2MJZCpTwb99ovOa2NPwLzkGDKO4aRq3QoGvjo1LRAiZqQUlJ
Tfy4gMxLFiqfc7j1aZ70nRE5lugimRQGgAtiLN8S5yrRJW9CuOIi4gHVLy+Mqcyy
/7k3l9y8yGCgG+59LmEq
=URlj
-----END PGP SIGNATURE-----

--BdsCKoIPTq18eNodo6UnoMBc21vtVqjPq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c9557aa9-5e82-0ba5-cdfc-f883c09f9b6d>