more on holey files
By relling on Apr 08, 2008
My colleague Christine asked me some questions about my holey files posts. These are really good questions, and I'm just a little surprised that more people didn't ask them... hey, that is what the comments section is for! So, I thought I would reply publically, helping to stimulation some conversations.
Q1. How could you have a degraded pool and data corruption w/o a repair? I assume this pool must be raidz or mirror.
A1. No, this was a simple pool, not protected at the pool level. I used the ZFS copies parameter to set the number of redundant data copies to 2. For more information on how copies works, see my post with pictures.
There is another, hidden question here. How did I install Indiana such that it uses copies=2? By opening a shell and becoming root prior to beginning the install, I was able to set the copies=2 property just after the storage pool was created. By default, it gets inherited by any subsequent file system creation. Simple as that. OK, so it isn't that simple. I've also experimented with better ways to intercept the zpool create, but am not really happy with my hacks thus far. A better solution is for the installer to pick up a set of properties, but it doesn't, at least for now.
Q2. Can a striped pool be in a degraded state? Wouldn't a device faulting in that pool renders it unusable and therefore faulted?
A2. Yes, a striped storage pool can be in a degraded state. To understand this, you need to know the definitions of DEGRADED and FAULTED. Fortunately, they are right there in the zpool manual page.
One or more top-level vdevs is in the degraded state because one or more component devices are offline. Sufficient replicas exist to continue functioning.
One or more top-level vdevs is in the faulted state because one or more component devices are offline. Insufficient replicas exist to continue functioning.
By default, there are multiple replicas, so for a striped volume it is possible to be in a DEGRADED state. However, I expect that the more common case will be a FAULTED state. In other words, I do tend to recommend a more redundant storage pool: mirror, raidz, raidz2.
Q3. What does filling the corrupted part with zero do for me? It doesn't
fix it, those bits weren't zero to begin with.
A3. Filling with zeros will just make sure that the size of the "recovered" file is the same as the original. Some applications get to data in a file via a seek to an offset (random access), so this is how you would want to recover the file. For applications which process files sequentially, it might not matter.