AutoUnmountNotifications

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 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). NOTE: 2.6.19 adds this option for FAT - diegocg

* Instead of popping up a notification when the device is removed (and the damage has already been done), why not pop up the first time a certain device is inserted, and make it easier to unmount? Sorta like the "Safely Remove Hardware" icon in Windows, which is not strictly necessary for Windows because they're sync, but would be extremely useful on Ubuntu...

^ Good idea. Maybe the text could read something like: "Removable devices need to be disabled by using the 'Eject' option before you remove them from your computer, otherwise the device may suffer from data loss. You can find this option by right-clicking the desktop icon for this device."

^ Just don't forget the 'Do not bother me again' checkbox, please.

  • Have an eject button next to icon, a image mock up is Here, this would also semi-imply that the device needs to be ejected (to completely new users), and possibly a popup box to confirm eject (in case of accidental click while trying to open file, Eject and Cancel would be the options)


CategorySpec

AutoUnmountNotifications (last edited 2008-08-06 16:38:54 by localhost)