SU+J Lost files after a power failure
freebsd at edvax.de
Tue Oct 15 12:16:08 UTC 2013
On Tue, 15 Oct 2013 07:47:55 -0400 (EDT), Daniel Feenberg wrote:
> We have a disk-to-disk backup that runs continuously. I have found that if
> I unmount the backup disk and remove it without delay, then sometimes it
> requires an fsck to remount. So I believe that umount does not wait for
> all writes to complete.
Correct, that's what I wanted to suggest. When umount
finishes successfully, it simply means that the disk
driver has finished accepting data for write and sent
it to the disk. If the _disk_ has actually correctly
written that data - you probably can't be 100% sure.
> I understand that buffers are written out to disk
> at least every 30 seconds, but it may take some time for the buffers to be
> flushed and the disk itself has a buffer and I have never seen any
> discussion of the maximum delay there. So the minimum wait for a safe
> removal remains unknown.
I do the same with external disks here. After unmounting
them, I wait a while before switching off the power and
disconnect the disk. Until now, no problems regarding a
> Perhaps some trick like unmounting, then remounting with fsync, then
> unmounting would ensure all buffers were at least sent to the disk, but
> I have never seen that suggested.
Still you can't be 100% sure here. An imaginary method
would be like this:
1. signal umount to the disk
2. grab last buffers not flushed yet, flush them
3. prohibit any new writes (no new buffers)
4. read from the disk and compare to the last
buffers - make sure they are _on disk_, only
then the data is consistent
5. now unmount the disk
6. exit the umount program successfully
That would mean that "mount /mnt" would take much longer
as expected, and _still_, you can't be 100% sure. :-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions