You are not logged in.

#51 2010-04-14 15:52:20

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: Udev still recommended?

xduugu, thanks for the rules set you made. one problem was faced with default file system setting  is a new file created is not properly saved unless unmount the volume manually. To be more clear it goes like this
> touch sometext  (remove the volume without unmount keep sometext there)
> put some thing on this file and save(remove the volume without manual unmount  no text in sometext)
as per the rule remove action  un-plugging should unmount the volume.

can some one shed light on this..

Offline

#52 2010-04-18 19:59:07

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: Udev still recommended?

That happens because of mounts async option:

async  All I/O to the filesystem should be done asynchronously. (See also the sync option.)

So when you unplug your device, there may be data which hasn't written yet. This data will be lost if you simply unplug a device. There are several options to get this data written:

1. run "sync" before unplugging which flushes all the data from the cache to the devices
2. use mounts sync option:

sync   All I/O to the filesystem should be done synchronously. In case of media with limited number of write cycles (e.g. some flash drives) "sync" may cause  life-cycle shortening.

3. unmount the device before unplugging: only possible as root but it would also be possible to write a fstab entry when a device is plugged in so that it can also be unmounted as an user (may introduce a race condition though: what happens to fstab if more than one device is plugged in/unplugged at the same time?)
4. use pmount to mount the devices which can mount / umount devices as user: I think there is an adjusted udev rule in the wiki, but you may have to patch it to get e.g. ext4 support.

Offline

#53 2010-04-18 21:18:43

gladstone
Member
Registered: 2009-01-03
Posts: 74

Re: Udev still recommended?

@xduugu: a useful summary of disk syncing in Linux. Thanks.

Offline

#54 2010-04-18 21:19:40

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Udev still recommended?

xduugu wrote:

it would also be possible to write a fstab entry when a device is plugged in so that it can also be unmounted as an user (may introduce a race condition though: what happens to fstab if more than one device is plugged in/unplugged at the same time?)

FYI that would also be abuse of fstab:

man fstab wrote:

fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file.

I use the pmount variant myself - works perfectly for my mostly-vfat with-occasional-ext3 selection of devices.

Offline

#55 2010-04-18 21:50:32

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: Udev still recommended?

tomk wrote:

FYI that would also be abuse of fstab:

man fstab wrote:

fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file.

All right, was just an idea because the "users" mount option only works in fstab. But it would be ugly anyway. wink

My personal "ideal solution" would be a systray application that reads /proc/self/mounts and can umount devices when run as root. I hope I get this done soon.

Offline

Board footer

Powered by FluxBB