[dm-crypt] Auto Mounting when file accessed?

Roger rogerx at acsalaska.net
Thu Jan 13 02:14:17 CET 2011


>On Wed, Jan 12, 2011 at 10:05:00PM +0100, Ma Begaj wrote:
>
>inotify-tools could probably help you... something like this could
>work, i think;
>
>------------------------------------
>#!/bin/sh
>
># watch for folders
>inotifywait -m -r --format "%e %w%f" /mnt/crypt | while read event file; do
>
>    # and mount if not mounted
>    if ! df | grep /mnt/crypt >/dev/null ; then
>        mount /mnt/crypt
>    fi
>done
>------------------------------------


Oh, and one more big thing, a user can use:

vi /mnt/crypt/blah.txt, and vi will still open a file even though mounting has
been called for.  Same goes for any other command used on /mnt/crypt before
it's mounted.

And I think this is where dbus/udev would step in and hold or wait command and
mount before proceeding with the command on the filesystem.

-- 
Roger
http://rogerx.freeshell.org/


More information about the dm-crypt mailing list