On 2/21/2012 6:01 AM, kfx wrote:
> After a crash, a lot of files on a xfs file system report an empty size
> with "ls -a" but not with "du".
> xfs_check and xfs_repair don't report any problem to repair (although an
> internal log is used) :(
> So if I understand correctly, those empty files actually use space on
> the disk but are incorrectly reported as empty by the system.
> Is there a way to copy back the used blocks to recover the files ?
What was the nature of the crash? Kernel panic? Power failure? Other?
Do you have have backups of previously existing files that are now shown
as zero size? If so delete and restore, maybe just overwrite.
For new files that were in the process of being created you're simply
out of luck. The metadata may have hit the journal but the file data in
buffer cache was lost.
In memory write buffering/ordering techniques are what give modern
filesystems their write throughput performance. Unfortunately this
comes at a cost, when systems crash. As Peter mentioned, one way to
mitigate this is coding apps to sync their writes. This obviously has a
performance impact. Another is possibly to mount filesystems with the
sync option, which will obviously severely impact write performance.
Both will prevent or at least lessen the carnage you've seen as a result
of this crash. You may not be able to live the performance of the