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
- 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.
- Do not execute above
umount
commands when inside mounted path (Folder/Drive/Device) itself. First, you may usepwd
command to validate your current directory path (which should not be the mounted path), then usecd
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
How to Preserve Command Line Spaces in a Linux Application
How to Check All Columns Data Types of Table Using Awk Script
Using a Remote Host's Usb Port as Local Usb (Linux and Windows)
Find All Zero-Byte Files in Directory and Subdirectories
What Exactly Is Sudo Bang Bang
Difference Between Vm.Dirty_Ratio and Vm.Dirty_Background_Ratio
Changing Name of the Video While Downloading via Youtube-Dl
Stracing to Attach to a Multi-Threaded Process
What Is the Access Time in Unix
Why Would It Be Impossible to Fully Statically Link an Application
How to Make Find and Printf Works in Bash Script
Ansible Inside Script Command Not Found
Custom Linux Gui: Where to Begin
Linux Free Shows High Memory Usage But Top Does Not
How to Pass Argument in Expect Through the Command Line in a Shell Script
How to Make Stdout and Stderr Output Be of Different Colors in Xterm or Konsole
How to Generate PDF from Docbook 5.0
Linux: Screen Desktop Video Capture Over Network, and Vnc Framerate