6

I have successfully setup Debian stretch on ZFS, including the root file system. Things are working like expected, and I was thinking that I had understood the basic concepts - until I re-read Sun's ZFS documentation.

My scenario is:

  • I'd like to prevent (more precisely: detect) silent bit rot

  • For the moment, I have set up a root pool with one vdev which is a mirror of two identical disks

  • Of course, I did turn on (i.e. did not turn off) checksums

Now I have come across this document. At the end of the page, they show the output of the zpool status command for their example configuration,

[...]
NAME        STATE     READ WRITE CKSUM
tank        DEGRADED     0     0     0
  mirror-0  DEGRADED     0     0     0
    c1t0d0  ONLINE       0     0     0
    c1t1d0  OFFLINE      0     0     0  48K resilvered
[...]

followed by the statement:

The READ and WRITE columns provide a count of I/O errors that occurred on the device, while the CKSUM column provides a count of uncorrectable checksum errors that occurred on the device.

First, what does "device" mean in this context? Are they talking about a physical device, the vdev or even something else? My assumption is that they are talking about every "device" in the hierarchy. The vdev error counter then probably is the sum of the error counters of its physical devices, and the pool error counter probably is the sum of the error counters of its vdevs. Is this correct?

Second, what do they mean by uncorrectable checksum errors? This is a term which I thought is usually used when talking about physical disks, either relating to data transfer from the platter into the disk's electronics, to checksums of physical sectors on the disk or to data transfer from the disk's port (SATA, SAS, ...) to the mainboard (or controller).

But what I am really interested in is whether there have been checksum errors at ZFS level (and not hardware level). I am currently convinced that CKSUM is showing the latter (otherwise, it wouldn't make much sense), but I'd like to know for sure.

Third, assuming the checksum errors they are talking about are indeed the checksum errors at the ZFS level (and not hardware level), why do they only show the count of uncorrectable errors? This does not make any sense. We would like to see every checksum error, whether correctable or not, wouldn't we? After all, a checksum error means that there has been some sort of data corruption on the disk which has not been detected by hardware, so we probably want to change that disk as soon as there is any error (even if the mirror disk can still act as "backup"). So I possibly did not understand yet what exactly they mean by "uncorrectable errors".

Then I have come across this document which is even harder to understand. Near the end of the page, it states

[...] ZFS maintains a persistent log of all data errors associated with a pool. [...]

and then states

Data corruption errors are always fatal. Their presence indicates that at least one application experienced an I/O error due to corrupt data within the pool. Device errors within a redundant pool do not result in data corruption and are not recorded as part of this log. [...]

I am heavily worried about the third sentence. According to that paragraph, there could be two sorts of errors: Data corruption errors and device errors. A mirror configuration of two disks is undoubtedly redundant, so (according to that paragraph) it is no data corruption error if ZFS encounters a checksum error on one of the disks (at the ZFS checksum level, not the hardware level). That means (once more according to that paragraph) that this error will not be recorded as part of the persistent error log.

This would not make any sense, so I must have got something wrong. For me, the main reason for switching to ZFS was its ability to detect silent bit rot on its own, i.e. to detect and report errors on devices even if those errors did not lead to I/O failures at the hardware / driver level. But not including such errors in the persistent log would mean losing them upon reboot, and that would be fatal (IMHO).

So eventually Sun has chosen worrying wording here, or I have misunderstood some concepts (not being a native English speaker).

  • Is not ZFS in Linux, still unstable? – Rui F Ribeiro Feb 1 '17 at 10:17
  • I do not think so. There is a lot of Linux software with version numbers like 0.x which is nevertheless stable, and as far as I know, ZFS on Linux is considered stable and used in production by large companies and in large setups. I had no issues with it, besides not understanding Oracle's documentation as described in my post. – Binarus Feb 2 '17 at 9:08
  • You should put the answer in the Answer box, please. – Jeff Schaller Feb 2 '17 at 10:55
  • @JeffSchaller Done ... – Binarus Feb 2 '17 at 11:06
4

For a general overview, see Resolving Problems with ZFS, most interesting part:

The second section of the configuration output displays error statistics. These errors are divided into three categories:

  • READ – I/O errors that occurred while issuing a read request
  • WRITE – I/O errors that occurred while issuing a write request
  • CKSUM – Checksum errors, meaning that the device returned corrupted data as the result of a read request

These errors can be used to determine if the damage is permanent. A small number of I/O errors might indicate a temporary outage, while a large number might indicate a permanent problem with the device. These errors do not necessarily correspond to data corruption as interpreted by applications. If the device is in a redundant configuration, the devices might show uncorrectable errors, while no errors appear at the mirror or RAID-Z device level. In such cases, ZFS successfully retrieved the good data and attempted to heal the damaged data from existing replicas.


Now, for your questions:

First, what does "device" mean in this context? Are they talking about a physical device, the vdev or even something else? My assumption is that they are talking about every "device" in the hierarchy. The vdev error count then probably is the sum of the error counts of its physical devices, and the pool error count probably is the sum of the error counts of its vdevs. Is this correct?

Each device is checked independently and all its own errors are summed up. If such an error is present on both mirrors or the vdev is not redundant itself, it propagates upwards. So, in other words, it is the amount of the errors affecting the vdev itself (which is also in line with the logic of displaying each line separately).

But what I am really interested in is whether there have been checksum errors at ZFS level (and not hardware level). I am currently convinced that CKSUM is showing the latter (otherwise, it wouldn't make much sense), but I'd like to know for sure.

Yes, it is the hardware side (non-permanent stuff like faulty cables, suddenly removed disks, power loss etc). I think that is also perspective: faults at the "software side" would mean bugs in ZFS itself, so unwanted behavior that has not been checked for (assuming all normal user interactions are deemed correct) and that is not recognizable by ZFS itself. Fortunately, they are quite rare nowadays. Unfortunately, they are also quite sever most of the times.

Third, assuming the checksum errors they are talking about are indeed the checksum errors at the ZFS level (and not hardware level), why on earth do they only show the count of uncorrectable errors? This does not make any sense. We would like to see every checksum error, whether correctable or not, wouldn't we? After all, a checksum error means that there has been some sort of data corruption on the disk which has not been detected by hardware, so we probably want to change that disk before as soon as there is any error (even if the mirror disk can still act as "backup"). So I possibly did not understand yet what exactly they mean by "uncorrectable".

Faulty disks are already indicated by read/write errors (for example, URE from a disk). Checksum errors are what you are describing: a block was read, its return value was not deemed correct by the checksums of the blocks above it in the tree, so instead of returning it it was discarded and noted as an error. "Uncorrectable" is more or less definition, because if you get garbage and know that it is garbage, you cannot correct it, but you can ignore and not use it (or try again). The wording might be unnecessarily confusing, though.

According to that paragraph, there could be two sorts of errors: Data corruption errors and device errors. A mirror configuration of two disks is undoubtedly redundant, so (according to that paragraph) it is no data corruption error if ZFS encounters a checksum error on one of the disks (at the ZFS checksum level, not the hardware level). That means (once more according to that paragraph) that this error will not be recorded as part of the persistent error log.

Data corruption in this paragraph means some of your files are partly or completely destroyed, unreadable and you need to get your last backup as soon as possible and replace them. It is when all of ZFS' precautions have already failed and it cannot help you anymore (but at least it informs you about this now, not at the next server bootup checkdisk run).

For me, the main reason for switching to ZFS was its ability to detect silent bit rot on its own, i.e. to detect and report errors on devices even if those errors did not lead to I/O failures at the hardware / driver level. But not including such errors in the persistent log would mean losing them upon reboot, and that would be fatal (IMHO).

The idea behind ZFS systems is that they do not need to be taken down to find such errors, because the file system can be checked while online. Remember, 10 years ago this was a feature that was absent in most small-scale systems at the time. So the idea was that (on a redundant config of course) you can check read and write errors of the hardware and correct them by using good known copies. Additionally, you can scrub each month to read all data (because data not read cannot be known to be good) and correct any error you find.

It is like a big archive/library of old books: you have valuable and not so valuable books, some might decay over time, so you need a person that goes around each week or month and looks at all pages of all books for mold, bugs etc., and if he finds anything he tells you. If you have two identical libraries, he can go over to the other building, look at the same book at the same page and replace the destroyed page in the first library with a copy. If he would never check any book, he might be in for a nasty surprise 20 years later.

  • Thanks for clarifying. Yes, the concept of scrubbing has already been clear to me. Me problem was that Sun's documentation makes the impression that the error counters (Read I/O, Write I/O, CKSUM) will not be preserved during reboots, and this of course would be completely not acceptable (also see my answer). – Binarus Feb 2 '17 at 11:06
2

After having thought some more time about the subject and after having read user121391's answer multiple times, I'd like to answer my own questions, thereby trying to clarify user121391's statements even more. If there is something wrong, please correct me.

First question: What does "device" mean?

This has been clarified by user121391; I could not add anything meaningful.

Second and third question: What are uncorrectable errors / why are only uncorrectable errors shown in the error counters?

The wording chosen by Sun / Oracle is very unclear and misleading. Normally, when a disk (or any hardware component up in the hierarchy) encounters a data integrity error, two things could happen:

  • The error can be corrected (by mechanisms like ECC and so on), and the respective component passes the data on after it has been corrected (thereby possibly increasing some error counter which an administrator can read out by appropriate tools).

  • The error can not be corrected. In this case, usually an I/O error occurs to inform hardware / driver / applications that there was a problem.

Now, in rare cases, the I/O error does not occur even if there was a data integrity error which has not been corrected. This could be due to buggy software, failing hardware and so on. It is the thing which I personally mean by "silent bit rot", and is exactly the thing for which I have switched to ZFS: Such errors are detected by ZFS's own "end-to-end" checksumming.

So, a ZFS checksum error is exactly a data (integrity) error at the hardware level which has not lead to an I/O error (as it should have), and hence is undetected by any mechanism except ZFS's own checksumming, and vice versa. In that sense, the number of errors in the CKSUM column of the zpool status -v command is the number of the ZFS checksum errors as well as that of the undetected hardware errors, as these two numbers are just identical.

In other words, if the device had corrected the integrity error on its own, or (if the error had been uncorrectable) had set an I/O error, ZFS would not have increased its CKSUM error counter.

I have been heavily worried by that section of Sun's documentation since the term "uncorrectable errors" is never explained and as such is very misleading. If they instead had written "uncorrectable hardware errors which did not lead to I/O errors as they normally should", I would not have had any issues with that part of the documentation.

So, in summary, and to stress again: "uncorrectable" in this context means "uncorrectable and undetected at the hardware level" (undetected in the sense that no I/O error occurred despite the data (integrity) error), not "uncorrectable at the ZFS level" (actually, as far as I know, ZFS does not try to correct bad data on single disks by some error correcting checksum mechanism, but it recognizes faulty data with the help of checksums and then tries to correct the data if there are correct copies of the data on other disks (mirror) or if the data can be reconstructed from data on other disks (RAIDZ)).

Last question (regarding the persistent log)

Once again, Sun's documentation is just wrong here (or at least so misleading that nobody will understand what really happens from reading it):

There are obviously at least two persistent logs.

The one of them the documentation talks about is the log which contains in detail which file could not be read due to an application I/O error, i.e. an I/O error or ZFS checksum error which could not be corrected even by the redundancy mechanisms of ZFS. In other words, if an I/O error happens at the disk level, but ZFS could heal that error by its redundancy mechanisms (RAIDZ, mirror), the error is not recorded in that persistent log.

IMHO, this makes sense. With the help of that log, an administrator understands at a glance what files should be restored from backup.

But there is a second persistent "log" the documentation does not mention: The "log" for the error counters. Of course, the error counters are preserved between reboots, whether the errors have been detected during a scrub or during normal operation. Otherwise, ZFS would not make any sense:

Imagine you have a script which runs zpool status -v once a day at 11 pm and mails the output to you, and you check those emails every morning to see if all is well. One day, at high noon, ZFS detects an error on one of its disks, increases the I/O or CKSUM error counters for the respective device, corrects the error (e.g. because a mirror disk has correct data) and passes on the data. In that case, there is no application I/O error; consequently, the error will not be written to the persistent error log the documentation talks about.

At that point, the I/O or CKSUM error counters are the only hint that there has been a problem with the respective disk. Then, two hours later, you have to reboot the server for some reason. Time pressure is high, production must continue, and of course you will not run zpool status -v manually in that situation before rebooting (you possibly can't log in anyway). Now, if ZFS would not have written the error counters to a separate "log", you would lose the information that there has been an error with one of the disks. The script which checks ZFS's status would run at 11 pm, and next morning, when studying the respective email, you would be glad to see that there has been no problem ...

For that reason, the error counters are stored somewhere persistently (we could discuss if we should call that a "log", but the key point is that they are stored persistently so that zpool status -v after a reboot shows the same results as it would have shown immediately before the reboot). Actually, AFAIK, zpool clear is the only method to reset the error counters.

I think Sun / Oracle does not do itself a favor when writing such unclear documentation. I am an experienced user (in fact, developer), and I am used to reading bad documentation. But Sun's documentation is really catastrophic. What do they expect? Should I really trick one of my disks into producing an I/O error and then reboot my server to see if the error counters are preserved? Or should I read the source code to answer such basic and important questions?

If I would have to make a decision for or against ZFS / Solaris, I would read the docs and then decide. In this case, I would clearly decide against since from the docs I would get the impression that the error counters are not preserved when rebooting, and this of course would be completely not acceptable.

Fortunately, I have tried ZFS after reading some other articles about it and before reading Sun's documentation. As bad as the documentation is, as good is the product (IMHO).

  • 1
    Thanks for summing it up, your first part is exactly like I would describe it. I also forgot to respond to your reboot question, but now I remember that all my Checksum errors were from before reboots, so they were never removed automatically. Per default, almost nothing happens automatically on Solaris, because it is assumed there is a full-time administrator to look after it (for example, automatically removing and replacing disk is not the default, adding a boot sector to a mirrored drive on mirroring is not the default and so on). – user121391 Feb 2 '17 at 14:15
  • Although I have to agree that the mentioned documentation could be a bit more specific, you have to remember that it is a end-user documentation, and is written so that you know the basics to operate the system. More details, like for example how checksums work, are available in other documents (and partly also on blogs and presentations, which is of course not perfect, but we know what happened to Sun, so that will not get fixed). – user121391 Feb 2 '17 at 14:22
  • 1
    On the plus side, you have (especially on illumos distributions) very very good manpages. They have all the needed info and real-life examples from easy to hard, so that you can administer your system without any online resources or stackoverflow, just by reading the manpages. If you try that with most of the GNU tools or even the older BSD tools, you will feel like someone forced the developer to write that manpage... – user121391 Feb 2 '17 at 14:25
  • @user121391 Thanks for mentioning Illumos. Perhaps I will try to install it in a VM out of curiosity (would like to see the man pages). On Linux, the man pages I have found seem to be good in that they seem to describe every command's options precisely. But I haven't found man pages explaining the concepts or answering any of the questions I have posted (this would be unusual under Linux). – Binarus Feb 2 '17 at 15:59
  • As examples, see illumos.org/man/1m/zfs with 21 examples or illumos.org/man/1/chmod with 28 examples at the end. Unfair comparison to that: linux.die.net/man/1/tar ... It might of course be personal preference, but I generally prefer the more natural syntax of "zpool create poolname mirror disk1 disk2 log disk3" to "tar -xvjf filename" (I never remember it correctly). Option switches are reserved for special needs, not the most frequent normal ones. Also, if you want to explore, I suggest starting with OmniOS, then SmartOS, then the rest. These two are the most active. – user121391 Feb 2 '17 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.