1

I have recently been having problems running df -h, where it just hangs?

I tried running dmesg and getting the following snipped output:

[163075.079660] nfs: server 10.52.88.225 not responding, timed out
[163255.559732] nfs: server 10.52.88.225 not responding, timed out
[163255.559746] nfs: server 10.52.88.225 not responding, timed out
[163436.039699] nfs: server 10.52.88.225 not responding, still trying
[181222.119076] Key type cifs.spnego registered
[181222.119084] Key type cifs.idmap registered
[3350628.620368] hrtimer: interrupt took 10952185 ns

And when I pinged 10.52.88.225, it is throwing "Destination Host Unreachable".

So what I am trying to achieve is giving df may be only 10 seconds and if it does not respond, then terminate and process the next one in the list. Any script can be made to do this?

Any response/feedback will be much appreciated.

Manish Narang
  • 87
  • 1
  • 1
  • 10

1 Answers1

1

Try this one:

timeout [options] 10s <command> [args]

Update:

If you need to control/abort a stalled df and see output for other mounts, you may need to run 1 "df" for each mount; to keep things simple, maybe a shell script similar to this:

  • select lines from a list of mounted filesystems (eg /etc/mtab)
  • for each mount point run: timeout <short-limit> df $element
Milag
  • 1,793
  • 2
  • 9
  • 8
  • This will timeout the complete command after 10s but requirement is to timeout any corrupted mount point and move to next one in the list. – Manish Narang Jul 03 '20 at 20:57