UFS2 with Soft Updates Robust?

Erik Trulsson ertr1013 at student.uu.se
Thu Dec 23 00:52:42 PST 2004


On Thu, Dec 23, 2004 at 06:48:41AM -0000, John Conover wrote:
> Erik Trulsson writes:
> > On Wed, Dec 22, 2004 at 08:57:00PM -0900, Damien Hull wrote:
> > > On Tue, 2004-12-21 at 21:31 -0500, Chuck Swiger wrote:
> > > > John Conover wrote:
> > > > > Is UFS2 with soft updates the most robust file system in freebsd?
> > > > 
> > > > No, although UFS2 with softupdates is robust enough for production use.
> > > > 
> > > > If you make the filesystem writes syncronous and disable write caching on the 
> > > > hard drive, you will improve the robustness at significant cost to performance.
> > > > 
> > > 
> > > Are you saying that the UFS2 file system sucks?
> > 
> > Not at all, but standard IDE-drives suck when it comes to robustness.
> > (They tend to lie and tell the OS that data has been written to the
> > disk, when in reality it has only been written to the disks cache.)
> > (Thus the advice above to turn off write-caching for maximum
> > robustness.)
> > 
> > If you use softupdates (on a disk that doesn't lie) the filesystem on
> > the disk will always be consistent, but data written during the last 30
> > seconds or so might not yet have been written to the disk, and can therefore
> > be lost if e.g. the power to the computer is turned off.
> >
> 
> Erik, does that mean if you use softupdates, (on a SCSI,) that,
> although file(s) currently being written may be truncated since the
> cache is not flushed, that the file system can be repaired
> automatically by fsck to a consistent state?

That is the idea.  With softupdates the filesystem *on the disk* should
always be in a consistent state, such that fsck should always succeed.
(At least that is the theory, I haven't tested how well it holds in
reality.)


> 
> Even without synchronous writes or enabling cache write through?
> 
> 	John
> 
> BTW, the reason for the question is that most SCSIs today have many
> meg of HW cache, and many, (maybe most,) controllers don't permit
> write through anymore. So, even if the OS flushes its cache, the HW
> cache may not be written to the disk-so synchronous writes and OS
> cache write through may be of little value.

The only cache that can mess up things is that on the disk itself.
Forget about any caches managed by the OS - they are handled by the
filesystem code and flushed when needed.


The cache on the disk is another matter.  One difference between SCSI
and IDE is that SCSI support tagging which lets the OS determine if a
given block has actually been written to the disk or just to the disk's
cache.  This is needed for softupdates to work correctly.

On IDE-disks this information is often not available which means that
you may need to disable the write-cache on the disk (or at least make
it write-through) to be able to rely on the guarantees of softupdates.


A few IDE-disks and some of the newer S-ATA disks also support tagged
queueing, but support for that is not nearly as good as it is for SCSI
- not yet anyway.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list