Re: [systemd-devel] How to automount

2015-09-21 Thread Mantas Mikulėnas
> I don't think there's any way to have
something auto-unmount

There certainly is – udev has been unmounting unplugged drives for many
years. It's done by default.

On Mon, Sep 21, 2015, 23:10 Paul D. DeRocco  wrote:

> > From: Umut Tezduyar Lindskog [mailto:u...@tezduyar.com]
> >
> > I am not sure if automount is really the right way to go. In the end,
> > your automount path will fail if your device is not plugged in.
>
> A little experimenting showed you're right.
>
> > You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount')
> > to mount the volume.
> > http://www.freedesktop.org/software/systemd/man/systemd.device.html
>
> I was thinking about udev, too, but I don't think there's any way to have
> something auto-unmount. But I'm overcomplicating things. In my system, the
> only accesses made to this external flash drive are in response to a user
> command. So the simpler solution is just to have my application mount and
> unmount the drive, instead of trying to get the operating system to do it.
>
> --
>
> Ciao,   Paul D. DeRocco
> Paulmailto:pdero...@ix.netcom.com
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to automount

2015-09-21 Thread Paul D. DeRocco
> From: Mantas Mikulenas [mailto:graw...@gmail.com] 
> 
> > I don't think there's any way to have something auto-unmount
> 
> There certainly is - udev has been unmounting unplugged 
> drives for many years. It's done by default.

Sure, you can get it to unmount after you've removed it, but that's too
late if you haven't synced it. You have to do an explicit sync in advance
to avoid data loss. The only alternative is to disable write buffering,
which makes things slow, and stresses the drive.

In my case, it's better to mount and unmount explicitly around each
user-requested operation.

-- 

Ciao,   Paul D. DeRocco
Paulmailto:pdero...@ix.netcom.com

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to automount

2015-09-21 Thread Mantas Mikulėnas
On Tue, Sep 22, 2015 at 7:38 AM, Paul D. DeRocco 
wrote:

> > From: Mantas Mikulenas [mailto:graw...@gmail.com]
> >
> > > I don't think there's any way to have something auto-unmount
> >
> > There certainly is - udev has been unmounting unplugged
> > drives for many years. It's done by default.
>
> Sure, you can get it to unmount after you've removed it, but that's too
> late if you haven't synced it. You have to do an explicit sync in advance
>

Well you said:

> and unmounted when I unplug it.

Are you asking the OS to be prescient?


> to avoid data loss. The only alternative is to disable write buffering,
> which makes things slow, and stresses the drive.
>

No, that's not the only alternative – making the OS flush data more often
is another, e.g. as Windows does (every 2s), and AFAIK Linux has also
started doing so somewhere in the 3.x series.

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to automount

2015-09-21 Thread Paul D. DeRocco
> From: Umut Tezduyar Lindskog [mailto:u...@tezduyar.com] 
> 
> I am not sure if automount is really the right way to go. In the end,
> your automount path will fail if your device is not plugged in.

A little experimenting showed you're right.

> You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount')
> to mount the volume.
> http://www.freedesktop.org/software/systemd/man/systemd.device.html

I was thinking about udev, too, but I don't think there's any way to have
something auto-unmount. But I'm overcomplicating things. In my system, the
only accesses made to this external flash drive are in response to a user
command. So the simpler solution is just to have my application mount and
unmount the drive, instead of trying to get the operating system to do it.

-- 

Ciao,   Paul D. DeRocco
Paulmailto:pdero...@ix.netcom.com

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel