Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2013 14:15:58 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Daniel Feenberg <feenberg@nber.org>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: SU+J Lost files after a power failure
Message-ID:  <20131015141558.91dd5d63.freebsd@edvax.de>
In-Reply-To: <alpine.LRH.2.03.1310150742370.29524@nber.org>
References:  <525A6831.5070402@gmail.com> <l3gc7e$c91$1@ger.gmane.org> <20131014133953.58f74659@gumby.homeunix.com> <525C1D1C.9050708@gmail.com> <CA+tpaK2Pr2po2cQ1yanQK9+wLp77SYqYHjxiXaU5FfXwHrkGow@mail.gmail.com> <CAFYkXjn-1wTJcQ4a_fyXCvwh9ukt3+djM2qsMeaH1HhVJNvhiA@mail.gmail.com> <525C2554.7080203@pchotshots.com> <CAFYkXjm8y0Br31_pqRZc0sNFbqCNtKHhjeQuiLXkGT2zxSu0GA@mail.gmail.com> <525C2FBC.4080808@cran.org.uk> <alpine.LRH.2.03.1310141447520.16969@nber.org> <2351E8C5-4FC0-4AE9-AC21-312DA46C0EE8@mac.com> <20131015073048.83d7bca4.freebsd@edvax.de> <alpine.LRH.2.03.1310150742370.29524@nber.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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
forced fsck.



> 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. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20131015141558.91dd5d63.freebsd>