Force Unmount of Nfs-Mounted Directory

Force unmount of NFS-mounted directory

You might try a lazy unmount:

umount -l

How to unmount a busy device

YES!! There is a way to detach a busy device immediately - even if it is busy and cannot be unmounted forcefully. You may cleanup all later:

umount -l /PATH/OF/BUSY-DEVICE
umount -f /PATH/OF/BUSY-NFS (NETWORK-FILE-SYSTEM)

NOTE/CAUTION

  1. These commands can disrupt a running process, cause data loss OR corrupt open files. Programs accessing target DEVICE/NFS files may throw errors OR could not work properly after force unmount.
  2. Do not execute above umount commands when inside mounted path (Folder/Drive/Device) itself. First, you may use pwd command to validate your current directory path (which should not be the mounted path), then use cd command to get out of the mounted path - to unmount it later using above commands.

How do you force a CIFS connection to unmount

I use lazy unmount: umount -l (that's a lowercase L)

Lazy unmount. Detach the filesystem
from the filesystem hierarchy now, and
cleanup all references to the
filesystem as soon as it is not busy
anymore. (Requires kernel 2.4.11 or
later.)

Is there a good way to detect a stale NFS mount

You could write a C program and check for ESTALE.

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <iso646.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int main(){
struct stat st;
int ret;
ret = stat("/mnt/some_stale", &st);
if(ret == -1 and errno == ESTALE){
printf("/mnt/some_stale is stale\n");
return EXIT_SUCCESS;
} else {
return EXIT_FAILURE;
}
}

Linux: Which process is causing device busy when doing umount?

Look at the lsof command (list open files) -- it can tell you which processes are holding what open. Sometimes it's tricky but often something as simple as sudo lsof | grep (your device name here) could do it for you.

Howto mount and then unmount a filesystem in puppet?

Ultimately what you are attempting to do with puppet is not the intended "puppet way" so to speak. Puppet is a configuration management tool not a tool designed for one time batch jobs, as such doing things like this become "annoying".

Given that you cannot have resources in conflict (aka mount ensure => mounted, and mount => absent) in the same catalog compile, you are probably better off offloading the mounting etc to a script and execcing out (Which sadly is in my opinion always the cheap way, but best suited for this situation.)



Related Topics



Leave a reply



Submit