Unmount Mass Storage USB Device from the Command Line in Linux

Posted by Casey on Super User See other posts from Super User or by Casey
Published on 2010-06-03T11:07:20Z Indexed on 2010/06/03 11:14 UTC
Read the original article Hit count: 324

Filed under:
|
|
|
|

I've searched high and low, and can't figure this one out. I have a older Olympus Camera (2001 or so). When I plug in the USB connection, I get the following log output:

$ dmesg | grep sd
[20047.625076] sd 21:0:0:0: Attached scsi generic sg7 type 0
[20047.627922] sd 21:0:0:0: [sdg] Attached SCSI removable disk

Secondly, the drive is not mounted in the FS, but when I run gphoto2 I get the following error:

$ gphoto2 --list-config

*** Error ***              
An error occurred in the io-library ('Could not lock the device'): Camera is already in use.
*** Error (-60: 'Could not lock the device') ***       

What command will unmount the drive. For example in Nautilus, I can right click and select "Safely Remove Device". After doing that, the /dev/sg7 and /dev/sdg devices are removed.

Some things I've tried already are sdparm and sg3_utils, however I am unfamiliar with them, so it's possible I just didn't find the right command.

© Super User or respective owner

Related posts about linux

Related posts about scsi