Prevent umounting

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


If you want to keep people from unmounting, create a file:
/mnt/my_file_system/tmp/TMPxxxxxx

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 nerdbynature.de>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 redhat.com
> https://www.redhat.com/mailman/listinfo/ext3-users
>



-- 
Stephen Samuel http://www.bcgreen.com  Software, like love,
778-861-7641                              grows when you give it away
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20090615/1f0277ba/attachment.htm>


More information about the Ext3-users mailing list