Prevent umounting

Stephen Samuel (gmail) darkonc at
Mon Jun 15 19:58:26 UTC 2009

If you want to keep people from unmounting, create a file:

then unlink that file, but *do not close your open file descriptor.*

The name will disappear but the  inode will continue to exist. As long as
your program keeps the file descriptor for the unlinked file open, users
will be unable to unmount the filesystem

A simple example:
touch /media/disk-1/nothinge
tail -f /media/disk-1/nothing&
rm /media/disk-1/nothing

umount /media/disk-1
eject /media/disk-1
#  (both the last two commands should fail)..

kill %%
# kill the background 'tail' process
eject /media/disk-1
# that last 'eject' should work
On Sun, Jun 14, 2009 at 11:46 AM, Christian Kujau <lists at>wrote:

> [Cc'ing ext3-users again]
> On Sun, 14 Jun 2009, Donato Capitella wrote:
> > Well, that's not it.
> >
> > I modified the ext3 fs and added a kernel thread that performs deferred
> > operations. As long as this thread is working, I would like the file
> > system not to be unmounted.
> I still don't understand the reasoning here: "not to be unmounted" as in
> a permission-bound issue ("is not allowed to unmount") or a technical
> issue? For the latter: simply keep an open file on the filesystem, unmount
> will fail with -EBUSY. Or it's a matter of "because we can", as in
> "because I want to be able to disallow mounting on the filesystem level".
> But then again, I did not have my coffee yet and my brain keeps asking
> why, why, why? :)
> Christian.
> --
> BOFH excuse #202:
> kernel panic: write-only-memory (/dev/wom0) capacity exceeded.
> _______________________________________________
> Ext3-users mailing list
> Ext3-users at

Stephen Samuel  Software, like love,
778-861-7641                              grows when you give it away
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Ext3-users mailing list