Juergen Weigert <[EMAIL PROTECTED]> writes: > On a recent SUSE Linux df became unreliable for e.g. USB-drives. > This is because hald automatically mounts and unmounts such drives > as they are accessed. > > Usually I get something like: > > $ df /media/USB_DISK > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/sda1 0 0 0 - /media/USB_DISK > > only if the USB_DISK is being accessed, I get the expected output.
Thanks for reporting the issue. > A simple enhancement for df is to actively access the USB_DISK while running > statfs(). I've added an opendir() call in the attached patch. Wouldn't open() suffice? That would be simpler. Unless I'm missing something I'd rather not change the default behavor of df, as that would be a compatibility hassle. That is, df shouldn't attempt to mount file systems by default; it should do so only if the user asks, with a new option. Also, the main fix needs to be in fsusage.c, not df.c. If the new option is in effect, fsusage.c should attempt to open() the file, then use fstatfs on the result; it should fall back on statfs if the open fails. This will require a new boolean option to get_fs_usage, which asks it to use open/fstatfs rather than statfs (and similarly for the other hosts, e.g., use fstatvfs rather than statvfs). Finally, we'd need copyright papers from you to accept such a patch; I assume this is OK? _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
