bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: df enhancment for removable media


From: Kevin R. Bulgrien
Subject: Re: df enhancment for removable media
Date: Fri, 17 Mar 2006 12:33:37 -0600

"Juergen Weigert" <address@hidden> wrote in message news:address@hidden
> Hi coreutils people!
>
> 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.
>
> $ ls /media/USB_DISK > /dev/null; df /media/USB_DISK
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sda1               252522    238718     13804  95% /media/USB_DISK
>
> 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. This can be
> suppressed with a new commandline option -n.

I have just bumped into this issue for a bash plug-in I wrote for an
application that someone is running on Suse.  I had never heard of df
not showing up output when some filesystem had been mounted.

So now I have to decide how to harden the bash script against this.
I see in this thread that some discussion was had about fixing a
statfs() function instead of df.  Was there resolution to this and
is the user who is having trouble having it because he is on an older
version of df?

The simple example,

  $ ls /media/USB_DISK > /dev/null; df /media/USB_DISK

does not work for my user.  df still reports a size of 0.

One of my functions does work on this system, but it is a series of
find commands.  I don't want to clog the link to the USB device with
things that aren't necessary when I really just need free space.

Does anyone have any ideas on a simple and concise way to might deal
with this in the script.  I realize that it is odd because hald is
someone else's doing, but I'm not sure if there is some reasonably
simple way for me to make sure the media is mounted so df will report
what it needs to report.  I already issued the mount command, so from
the script's (and my) perspective it should be still mounted when df
runs.

Thanks,

Kevin R. Bulgrien
kbulgrien (at) att dot net







reply via email to

[Prev in Thread] Current Thread [Next in Thread]