Visit Our UNIX and Linux User Community


Umount of a "busy" disk


 
Thread Tools Search this Thread
Operating Systems Linux Umount of a "busy" disk
# 1  
Old 11-22-2010
Question Umount of a "busy" disk

A product I am working on manages storage. We are currently porting it from Solaris to Linux.
The product allows its user, among other things, to add and remove file server volumes, where these volumes are exported using the NFS or the CIFS protocol.
The problem is that when the user requests to remove a volume, it is quite possible that the volume is busy, since there is a client that uses it. This is particularly a problem with CIFS volumes (exported using a Samba server).

We have considered using lazy umount, but how can I know when the umount completes and I can actually remove the volume?

Solaris has a "force" umount, which we use. It performs the umount despite any open files on the volume. Unfortunately, Linux does not support it. The "-f" flag does not work this way, and by the documentation (and my tests) only works on remote NFS volumes I mount locally.

Any thoughts on the issue will be appreciated.
# 2  
Old 11-22-2010
Can you shutdown samba first?
# 3  
Old 11-23-2010
Bug Can't shut down Samba

Thanks for responding.

If I could have shut Samba up, then there would be no problem, since a Samba process is the one that keeps this file system busy.

I have tried using smbcontrol to close down the specific share that is the one we want to remove. It didn't cause Samba to close the connection either.

I have considered killing the smbd process that handles the client that accesses this share, but the problem is that the same client may use another share at the same time. I feared that killing the process will impair other I/O operations done by the same client to the other shares.
Nonetheless, this is an alternative that is still under consideration if I will not be able to come out with a better solution.

---------- Post updated at 09:34 AM ---------- Previous update was at 08:36 AM ----------

I have retried smbcontrol, and it seems that if I give it the actual process number of the smbd process that opens the exported directory then it works.
Giving it the "smbd" as the process name does not work, as i specified earlier.

I am going to explore this method and I hope it solves my problem.
# 4  
Old 11-23-2010
You need a lazy unmount.

Code:
 umount -l <file system>


Last edited by mark54g; 11-23-2010 at 03:16 PM.. Reason: code tags
# 5  
Old 11-23-2010
On Linux, lazy unmount denies further attempts to use the filesystem, but doesn't invalidate handles are open already, and keeps the filesystem technically mounted until the last one is closed. So if anything keeps holding that partition open, you've now got the worst of both worlds: A filesystem that can't be unmounted, can't be used, and can't be reinstated(because a lazy unmount can't be aborted). If something's persistently holding open the disk and you can't kill it, a lazy unmount will turn an annoyance into a disaster.

So this option is fairly dangerous.

You'll be able to tell when (or if!) it ever completes via df -h, I think.

If you have the necessary root permissions to unmount something, why can't you just stop samba properly?
# 6  
Old 11-24-2010
As I have written earlier, the Samba server cannot be stopped since there may be a number of volumes that are exported, and it is undesirable to disturb I/O to/from the other volumes.

I agree that the lazy umount is not good in my case, since if I want to deallocate the resources used for the volume I unmounted, I have no idea when they will actually be free.

As I mentioned above, I am currently exploring the possibility to use "smbcontrol stop-share" to break the connection to the volume I want to umount, which should allow me to use normal umount after that.

I wonder if there is a better solution.

Latest news: I tested the smbcontrol solution integrated to our product and it works!

Thanks to all those who replied.

Last edited by dhzdh; 11-24-2010 at 12:56 PM.. Reason: new results

Previous Thread | Next Thread
Test Your Knowledge in Computers #484
Difficulty: Medium
A compiler transforms source code into object code, a floating point number format that machines understand.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Solaris

How to remove a LUN in "Online Busy" state?

Hi all, I have a LUN that is in "Online Busy" when I issue the dev_gestate subcommand of luxadm: root@es088wb6:~# luxadm -v -e dev_getstate /dev/rdsk/c21t50050763090887FEd4s2 phys path = "/devices/pci@6c0/pci@1/pci@0/pci@4/SUNW,qlc@0/fp@0,0/ssd@w50050763090887fe,4:c,raw" ... (5 Replies)
Discussion started by: ludiegu
5 Replies

3. SCO

NFS umount shows the "Device busy (Error 16)"

Hi there After making a backup copy of it sometimes happens that when I want to unmount an NFS indicates the error:umount: /path_mount busy: Device busy (Error 16) if I run lsoff, I can not find the process that is blocking the application. I'm using OpenServer 5.0.2c as one NFS server ... (14 Replies)
Discussion started by: flako
14 Replies

4. Solaris

"Device busy" When Reopening Serial Port

Any help much appreciated. I am a Java developer, not a Solaris adept. I'm having an issue reopening serial port with the Java app I am developing. I develop in Windows and deploy the app on Solaris 10 (Sunfire X4170 with Xeon.) On the target machine my app uses the two serial ports... (11 Replies)
Discussion started by: Jim Ryan
11 Replies

5. UNIX for Dummies Questions & Answers

UNIX rm -rf error "rm: cannot remove `filename' : Device or resource busy"

Hi Everyone, I am trying to remove a directory: $ rm -rf directory_name/ rm: cannot remove `directory_name/filename': Device or resource busy What does this mean, and why can't I remove these files? I already tried moving into the directory, and removing the files individually, but I... (7 Replies)
Discussion started by: Anna_Z
7 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Solaris

Help:"Bad checksum in disk label" and "Can't open disk label package"?

Hello, I'm brand new to Sun/Solaris. I have a Sun Blade 150, with SunOS 5.8. I wanted to make a backup to prevent future data loss, so I put the disk in a normal PC with Windows XP to try to make a backup with Norton Ghost, the disk was detected, but not the file volume, so I place the disk... (6 Replies)
Discussion started by: Resadija
6 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

Featured Tech Videos