Automatically unmount encrypted USB flash drive when device is unplugged

Asked by Caleb Callaway

I formatted a flash drive using Karmic's Format utility, and selected the Encrypted FAT option. It mounts correctly when I plug it in, and I can access the files just fine. When I unplug the Flash drive without using the 'Safely Remove Drive' option, the icon on my desktop changes its name to '2.0 GB Encrypted', instead of disappearing and unmounting like my unencrypted Flash drives do.

I would like to have encrypted Flash drive treated in the same way as my unencrypted Flash drives, which disappear and unmount when unplugged, even if the 'Remove Safely' menu option isn't used. What can I do to accomplish this?

NOTES:
This is all in 64-bit Karmic Koala, with all the latest updates applied.

When I plug the encrypted Flash drive in, the following line shows up in the output of 'mount'. 'secure' is the name I gave the disk during the format process:

/dev/mapper/devkit-disks-luks-uuid-302db16c-c6e2-4dd9-a259-436437c76475-uid1005 on /media/secure type vfat (rw,nosuid,nodev,uhelper=devkit,uid=1005,gid=544,shortname=mixed,dmask=0077,utf8=1,flush)

The disk shows up on my desktop with the name 'secure'.

When I unplug the device, 'mount' still shows this line:

/dev/mapper/devkit-disks-luks-uuid-302db16c-c6e2-4dd9-a259-436437c76475-uid1005 on /media/secure type vfat (rw,nosuid,nodev,uhelper=devkit,uid=1005,gid=544,shortname=mixed,dmask=0077,utf8=1,flush)

The drive's contents can still be viewed in Nautilus, but I can't open files.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
subliminalfix (subliminalfix) said :
#1

selected the Encrypted FAT ?????

NTFS (New Technology File System)[1] is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7.[5]

NTFS supersedes the FAT file system as the preferred file system for Microsoft’s Windows operating systems. NTFS has several improvements over FAT and HPFS (High Performance File System) such as improved support for metadata and the use of advanced data structures to improve performance, reliability, and disk space utilization, plus additional extensions such as security access control lists (ACL) and file system journaling.

hope that clears up that somewhat???

Revision history for this message
Caleb Callaway (enlightened-despot) said :
#2

Thanks for the info, subliminalfix. To clarify, I formatted the USB flash drive using Karmic's Format Disk utility (right-click on a volume, select "Format..."), and selected "Encrypted, compatible with Linux (FAT)" from the "Type" drop-down menu.

Fortunately I don't have to worry about using my encrypted Flash drive on Windows, so I won't have to be concerned with NTFS vs. FAT. I'm only worrying about using it on Ubuntu Karmic (and UNR Karmic if I get it working).

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

You should always use the safetly remove device feature in ANY OS. Ripping the device from the port can and will corrupt the data as it may be accessed when you remove it. Unmounting manually tells the system you are going to remove the device and it will cease writing to the partition. This is exactly the same in windows and in mac.

Its your data so I cannot tell you wat to do but I can tell you what will happen if you do simply remove the device without telling your OS.

The mount is still there as (like I said) the OS has not been informed of your intentions. You will then have to umount -f (to force the unmount) the device.

Revision history for this message
Caleb Callaway (enlightened-despot) said :
#4

Hi actionparsnip, thanks for the answer. I understand the risks of disconnecting a Flash drive without unmounting it first. In this particular case the data I'm trying to access is static--I don't make modifications to it while the Flash drive is connected. So, I don't think data corruption is an issue for what I'm trying to do.

Even if data corruption is a concern, I would still like to have the encrypted Flash drives treated in the same way as unencrypted Flash drives. Somehow Ubuntu can 'clean up' after an unencrypted flash drive is removed by unmounting the volume automatically, but it isn't doing so for the encrypted Flash drive.

Revision history for this message
subliminalfix (subliminalfix) said :
#5

Im kinda NOobish so im not sure if there is a program for it . I understand what your saying. my brother runs ubuntu with a usb "bus or Hub" with about seven pen drives and he said something similar.

sorry hope you can get some more help

Revision history for this message
Caleb Callaway (enlightened-despot) said :
#6

Thanks subliminalfix, appreciate you taking to time to try and help out.

Revision history for this message
subliminalfix (subliminalfix) said :
#7

http://justinsomnia.org/2007/02/how-to-regularly-backup-windows-xp-to-ubuntu-using-rsync/

this isnt exactly it but older page and may give you some insight as to some commands to run?? may give you somewhere to start

Revision history for this message
Caleb Callaway (enlightened-despot) said :
#8

Thanks for the link--I wasn't able to find anything that seemed to help unfortunately.

Revision history for this message
subliminalfix (subliminalfix) said :
#9

so basically what your saying is with out selecting unmount device or eject hardware you can remove your flash or pen without an issue but if it is an encrypted usb it causes an error

im assuming your system is treating this as an active data storage as stated in the other advice posted here" dont just remove it"

my thought would be to treat it as a open unit instead(unencrypted) and hence no problem

i would take the 3-5 seconds more to do this chore unless you have a few minutes to create a custom launcher which you could eaisly task to do this for you then you could click and extract
instead of second mouse funtion or double click etc...
thats the closest i can think of and im rather NOobish.. sorry i couldnt help more

http://drbrainiac.wordpress.com/2007/11/04/how-to-create-custom-desktop-launchers-in-ubuntu-gnome/

Revision history for this message
subliminalfix (subliminalfix) said :
#10

also you may consider sending this to feature request in a submission form

peace.

Can you help with this problem?

Provide an answer of your own, or ask Caleb Callaway for more information if necessary.

To post a message you must log in.