AutoUnmountNotifications

Revision 8 as of 2006-06-23 08:42:10

Clear message

Summary

When users remove a device from their computer, such as a USB stick, and the device they removed is not unmounted, the desktop should pop up a warning to the user not to remove devices without first unmounting them due to possible data loss and/or corruption.

Rationale

The current kernel handling of 'sync' is inappropriate for flash devices, so we currently use 'async' as the less evil mount option. As long as the kernel does not offer a better behaviour, we should educate users about the necessity of telling the computer to 'eject' the device before you physically remove it.

Use cases

  • Mary uses Ubuntu for the first time, plugs in her USB stick, copies some files onto it, and pulls it out as soon as the copy dialog disappears. After going to a friend's computer to work with the files, she wonders why some of the files are missing (or even why the file system is corrupted).

Scope

Standard Ubuntu Gnome desktop.

Design

Whenever gnome-volume-manager notices that a previously mounted device has been removed while still in the 'mounted' state, a notification bubble is generated:

  • Removable devices need to be disabled by using the 'Eject' option in the device icon's context menu. You can use any of the icons on the desktop, Computer place, or mount applet. Otherwise the device may suffer from data loss or even file system corruption.

(TODO: improve English)

The notification will automatically disappear after 10 seconds.

Implementation

gnome-volume-manager already keeps track of removable devices and is notified about device removals from hal. We need to make sure that the data structures also keep track of the mount state. Other than that, we just need to add the libnotify call to the handler for removing a device.

Future improvements

  • Another possible way would be to use the device-mapper and add a fallback file to store the flushed data which is written at unmount. So we can add a button "Discard data" and wait until the user puts back the device to store the flushed data or clicks "Discard data". -- Johannes2
  • Eventually the kernel should provide a better behaviour for removable devices. This [http://www.ussg.iu.edu/hypermail/linux/kernel/0512.3/0050.html LKML post] sounds promising, but has not been tested, nor accepted upstream. It adds a new mount option flush which will synchronize changes when the last file descriptor is closed (i. e. right before the file copy dialog disappears).


CategorySpec