(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Kerio Reseller
Printer Friendly Version

Lazy umount


2008/09/17

I was actually looking for something else when I noticed that Linux umount has a "-l" option:



-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.)



Hate these ads?

I don't know when this was added, but it works as advertised. The following was done on a Fedora 9 system:



# create a couple of small filesystems to play with
lvcreate -L 2G -n test1fs VolGroup00
lvcreate -L 2G -n test2fs VolGroup00
mkfs -t ext3 /dev/VolGroup00/test1fs
mkfs -t ext3 /dev/VolGroup00/test2fs
mkdir /testdir
mount /dev/VolGroup00/test1fs /testfs
cd /testfs


OK, now login on another screen and try to unmount that. Of course we'll be told that it is "busy":



# umount /testfs
umount: /testfs: device is busy


No surprise there. To fix, we'd track down the process interfering with our desire by way of lsof or fuser, kill it off and proceed with our unmount. But with -l, we can do it now:



# umount -l /testfs







No complaints, and a check of "mount" shows it is really gone. This doesn't interfere at all with the process that still has it open: you can create new files, delete old ones, move around.. but the moment you cd off the mount, you can't get back.

But while you are there, nothing stops us from mounting something else at the same point:



mount /dev/VolGroup00/test2fs /testfs
cd /testfs


In fact, as strange as it sounds, we could have mounted test1fs again.. about the only thing we can't do is "fsck /dev/VolGroup00/test1fs" - that will rightfully tell us that the device really is busy. Unfortunately, neither lsof nor fuser can tell me what process is keeping that unavailable, but there have to be limits somewhere, right?

I wouldn't recommend using this as a matter of course, but there certainly are times when it could be handy. If you know a process will finish up by itself, this can allow you to let it do so while you get on with whatever you need to do. It's a helpful addition.



Comments


Thu Sep 18 17:15:55 2008: Subject:   JonR


I learned about lazy umount a few year ago, in the course of tearing my few remaining hairs out over stubborn USB devices that I was through with, but the system just couldn't seem to let go of.

Lazy umount has saved me from a lot of needless reboots. It's well named, isn't it? "Lazy" serves as a kind of tongue-in-cheek reminder to me, the user, that there may be a better, or at least an other, way out -- but...life is short.



Add your comments

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
10722951,542 1,542

numly esn 29970-080917-947106-73
numly barcode

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
Psst - Wanna work for yourself?

More:
       - Linux




Unix/Linux Consultants

Your ad here - $48.00 yearly!

http://www.schewanick.com SCO Unix, Solaris, Linx (various), PHP, MySQL, Apache, uniBasic, dL4, Perl, System Administration and more....


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.



Twitter
  • Nov 21 07:40
    @loudmouthman: well, a digital signature could prove it hadn't been altered. Text is no more insecure than anything else in that sense.
  • Nov 21 07:38
    Uggh. Lost $11.50 at poker last night by playing thoughtlessly and carelessly.







Coming Attractions

My Favorites

Change Congress


Related Posts