On Thu, Feb 05, 2009 at 02:43:29PM +0000, Ewan Chalmers wrote:
> I am interested to know whether XFS supports the sync mount option.
> I am using XFS on an external USB disk and automounting using the
> ubuntu/debian usbmount package
> (http://packages.ubuntu.com/intrepid/usbmount). The disk is connected
> to a headless server. I would like to be able to safely switch the
> disk on/off on demand without first logging in to the box to
> sync/unmount. I believe the sync option is essential to this use case.
> Using usbmount, it appears to work correctly, but the output to syslog
> makes me wonder.
You've pulled the plug on the block device, and you wonder why the
filesystem detects an IO error and shutѕ down? XFS is designed to protect
itself when something goes wrong with the underlying device.
Every time you switch off the drive you'll get these errors.
And "sync" only works if you turn drive write caches off or have
barriers enabled. There are many people out there that have systems
that are suseptible to fatal filesystem corruption that could be
triggered by doing this (because critical metadata is lost from
the volatile write cache on the drive when you power it off).
> The default configuration for usbmount includes
> FILESYSTEMS="ext2 ext3"
Oh, that might explain why kerneloops records so many crashes in
ext2/3 from people pulling the plug on USB drives...
> I have added xfs to the FILESYSTEMS list.
Please don't. I don't want to have to deal with all the shutdowns
and corrupted filesystem reports that this will result in.
> On switching off the disk, I see the following output in syslog
> kernel: [1034259.923629] usb 1-2: USB disconnect, address 26
> kernel: [1034259.936251] xfs_force_shutdown(sdb1,0x1) called from line
> 420 of file /build/buildd/linux-2.6.27/fs/xfs/xfs_rw.c. Return
> address = 0xe0a9ddb4
> kernel: [1034259.936334] Filesystem "sdb1": I/O Error Detected.
> Shutting down filesystem: sdb1
> But the disk remounts cleanly when it is switched back on.
That doesn't mean it hasn't been corrupted. Only an offline
check/repair will tell you that.
> I would be interested to know whether it is reasonable to use XFS in
> the way I have outlined.
No, it's not really a reasonable way to use any filesystem.