Post by Alan W. IrwinAccording to the above Wikipedia article, kernel version 2.6.30 got a
fix that substantially reduced the likelihood of creating zero-length
files for ext4 filesystems. This fix was backported to earlier
kernels by some Linux distributions. 'For instance Ubuntu made them
part of the 2.6.28 kernel in version 9.04 ("Jaunty Jackalope").' But
from the 10.04 version of kubuntu you mentioned above, it appears you
already have those kernel fixes. So maybe the fixes (which are
advertised to use ext3-like quick allocation in selected cases for
ext4) are not as reliable as using ext3 in the first place? If that
is the case, switching your filesystems back to ext3 might be the
answer, but that is no sure thing.
I have read articles about this Linux filesystem issue for a long time
now, and from your experience it is still not resolved so I think you
can expect it will take quite a long time to completely solve it.
Meanwhile, I would advise working around it using an uninterruptible
power supply (UPS) for your computer to insure there are no power
outages. A UPS is probably a good idea in any case because computer's
tend to last longer (at least that is my experience compared to others
here it town) if they are protected with a UPS. Anyhow, because
my computers are protected by UPS's I have never seen the zero-length
file issue.
I have been looking more closely at the files which have been set to
zero length, and I now think that my problem was not likely caused by a
power outage (or hardware reset) after all.
For the past while, whenever I have travelled, I have either copied the
files that I was actively using to an external hard drive or
synchronized those files using Unison. Then I have synchronized those to
my laptop or notebook before I left. When I returned home, I did the
reverse, i.e. used Unison to synchronize the files to the external drive
then from that to my desktop. I believe (but cannot be certain) that
files which were never copied this way are unaffected (whether they have
been changed on the desktop system or not). I think it is only a few of
the files (well a couple of hundred out of many thousands) which I have
transferred back and forth.
For the files I felt I might need on my wife's computer, I simply made a
DVD containing those since I normally would not be changing them, just
reading them (e.g. all her recipes). I don't think any of her files have
zero bytes, even though her computer has had similar power outages.
When I have copied files back to my desktop, I have most often just used:
cp -R -u --preserve=timestamps [directory on external drive] [directory
on desktop]
This seemed to work quite well, since only files that I had changed
while away would be copied back.
I now suspect that either there is something wrong with Unison, or less
likely, with cp. Since I first noticed the problem a long time after I
did any of these operations, I cannot be certain whether this is the key
or not. From the discussions on ext4 (which I had never even considered
looking at before), it would appear that there may be quite a few
applications which do not properly account for the long allocation delay
with ext4.
Very few of the files which are affected would have been in the process
of being modified at the time of any power outage. It will take me quite
a bit of checking to be certain, but I suspect that all of the affected
files may have been within the directories that were copied back and forth.
One side benefit of this has been that it has encouraged me to look at
those files and to cull a lot that I really don't need to keep. I have
already deleted over 2/3 of the ones with zero bytes which I have no
good reason to keep or try to recover, plus many, many others in the
same sub-directories as those affected!!
I will probably go back to ext3 as Alan has suggested. However, from
what I have read, I think that means copying everything to another drive
(at least the home directory), then doing a fresh install. This, of
course, will mean going through the painful process of reinstalling all
my third-party stuff and getting all the non-standard repositories
again. I am going to watch my list of zero byte files for a few days to
see if there are any changes before doing this. If not, it is not too
long till Ubuntu 11.04 is due to be released. If I want to upgrade to
that, I will have to go through all that pain anyway.
If it turns out NOT to be a power outage issue, the UPC would not have
helped. I do agree that it is a good idea, though.
Murray