If I edit the files on my pendrive, and then just remove it physically, the data will not be recorded. I have to click "eject", and so the led starts to blink, and the data starts to be recorded.
How can I change this, so that the data is recorded instantly when changed?
update: Ubuntu 11.10
In Ubuntu 11.10 I wrote the rules file (from @enzotib answer), and works, but gives the following message when I try to eject/unmount:
(should I start another question for Ubuntu 11.10?)
Best Answer
Following the question (and answer) that @arrange shows in his comment, let's create a new file
and write into it the following content (see udev::Mount under /media; use partition label if present)
I have done some little modifications with respect to that reported on the website
sync
option toENV{mount_options}
gid=100
option touid=1000,gid=1000
, where the number are relative to your used-id and group-id, as returned byid -u
andid -g
The second one make you the owner of all files on the mounted partition, so no permission problem can arise. Obviously this is not the case if more than a single user should access the files, but this can be handled in other ways.
For non-windows filesystems, owner and group are metadata on the filesystem, and cannot be changed by a mount option.
The new rule is immediately active (udev uses inotify to detect new and modified rule files).
The mounted drive is not automatically opened in a file manager window, as you can see, and this is difficult to achieve, given that the mounting process is owned by root, and do not have access to your graphical login session. But the drive is on your desktop, so a simple double-click will open it.
Unfortunately I cannot get the desktop right-click unmount to work, but this is not a big problem: having the
sync
option in place, you can simply unplug the device, and the udev rule take care of removing the entry from/proc/mounts
and removing the mount-point.