0

I have some Ubuntu file server that is connected to several NFS disks. Due to some earthquake, some NFS disks became unresponsive. This results in the df command hanging forever. Is it possible to use df when some of the NFS disks are unresponsive? E.g., by specifying some timeout (such as: "if disk x doesn't respond within y second, skip").

9
  • 1
    I’m not sure this is what you’re looking for, but df -x nfs will list all non-NFS file systems (or -x nfs4 if you’re using v4). Commented Jul 17, 2021 at 18:56
  • Also consider switching to automounts so that if/when mounts are unavailable, they will unmount in the background. Commented Jul 17, 2021 at 19:28
  • @StephenKitt I want df or something else to list all the mounted disks and indicate available/used space for each of them. If some disks are unresponsive, then it should state so or at worse, skip it. Commented Jul 17, 2021 at 22:21
  • I find the following alias useful: alias dflocal='df -x nfs4 -x cifs'. Actually, the version I use also has -x tmpfs -x devtmpfs because most of the time I'm not interested in /run, /dev, /dev/shm, /run/lock or other tmpfs mounts. if I used other kinds of network filesystems, I'd add them to the alias too.
    – cas
    Commented Jul 18, 2021 at 2:05
  • 1
    right. i'm suggesting something along the lines of a shell loop, iterating over the list of filesystems produced by mount, doing one df call per fs with a timeout attached. i'm not in a place to set up a test, nor am i even sure it would work since the -x nfs flag isn't enough to prevent the hang, but it might be worth looking into?
    – Fox
    Commented Jul 18, 2021 at 3:20

0

You must log in to answer this question.

Browse other questions tagged .