0

I have a canon camera plugged into the usb of my Pi. I want to unmount or eject it but I dont know how to find the device name to supply to the unmount or eject command. lsblk gives the following and not the /dev/sda paths

pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 59.6G  0 disk 
├─mmcblk0p1 179:1    0  1.8G  0 part 
├─mmcblk0p2 179:2    0    1K  0 part 
├─mmcblk0p5 179:5    0   32M  0 part /media/pi/SETTINGS7
├─mmcblk0p6 179:6    0   69M  0 part /boot
└─mmcblk0p7 179:7    0 56.4G  0 part /

lsusb shows it on 7

pi@raspberrypi:~ $ lsusb
Bus 001 Device 006: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 005: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 001 Device 004: ID 16d0:063d MCS 
Bus 001 Device 007: ID 04a9:30fc Canon, Inc. PowerShot A620 (PTP mode)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
1

Note the column labeled MOUNTPOINT. lsblk shows your camera is not mounted. It shows the only mounted device partitions are on your SD card. lsusb has nothing to do with "mounting", it concerns itself only with devices on the bus.

Try this experiment to prove it to yourself:

  • run lsblk -fs
  • insert a thumb drive in one of the USB ports
  • run lsblk -fs again

You'll see the thumb drive listed as sda (or sdb, or whatever), but there will be NO MOUNTPOINT in the output.

  • unfortuantly u are right i didnt understand what is going on but now i do – bakalolo Mar 19 at 4:21
  • @bakalolo: It's easy to get confused :) I've noticed this on my Canon cameras also... they (apparently) don't provide direct access to the media in the camera, instead requiring that you access the media through a software layer. I feel this is a "good thing" - corrupting a device with 2,000 RAW image files could be a headache! You also mentioned the eject command, and that caused me to wonder about some things. Outside the *nix world, unmount or umount are unknown. Apple & MS use the term "eject" as it makes more sense to more people. But this does lead to some confusion - for many of us! – Seamus Mar 24 at 19:52
1

You are using lsblk to find mounted devices. But lsblk is doing what its name says: it only lists block devices like hard disks or SD Cards. But the USB connection of your camera isn't seen as block device. Try to use

rpi ~$ findmnt
  • I'd not used findmnt until I read your answer. It's useful, but just out of curiosity, do you feel it's better than lsusb for learning details on connected USB devices? – Seamus Mar 24 at 19:39
  • @Seamus The question was about finding usb device name to unmount/eject. So you have to look how it is mounted. lsusb will not give you any information about mounting. – Ingo Mar 25 at 8:57
  • But it wasn't mounted according to lsblk output. lsblk showed there were no block storage devices other than the SD card mounted or connected. AFAIK, eject is only useful for CD/DVD devices... I'm of the opinion it doesn't accomplish much on flash memory devices - am I wrong? – Seamus Mar 25 at 14:25
  • @Seamus You are right with eject but the OP wants to unmount or eject his cannon camera and therefore he is looking for the device name. You find it neither with lsblk nor with lsusb. My cannon camera does mount with a pseudo filesystem GPhotoFS. It is a filesystem client based on libgphoto2 that exposes supported cameras as filesystems (similar to /dev or /sys). So I think you will only find the device name with mount or findmnt to unmount it with fusermount -u /mnt/mountlocation unix.stackexchange.com/a/402504/243074 – Ingo Mar 25 at 16:20
  • And the advantage of that is...? IoW, if it's not a mounted filesystem, then there is no reason not to just "pull the plug" - is there? oh, +1 BTW - this is v. helpful IMO. – Seamus Mar 25 at 16:46
0

Which camera model do you have? Most "newer" cameras no longer connect to the computer as a "mass storage device". A "mass storage device" is typically "owned" by one controller. In other words... when mounted by the computer, it cannot be used by the "camera" because the computer wants exclusive block level access to the file system.

The advantage of protocols such as PTP (Picture Transfer Protocol) is that it's a logical protocol that ignores the notion of a block-storage device with an exclusive owner. This means that while the computer is transferring images from the camera, the camera can continue to capture more images (more than one device can use the memory card).

If this is true of your camera model (some cameras let you set which mode should be used, but few "newer" cameras offer the choice) is that there is no mass-storage device to "eject".

Rather than connecting the "camera" via a connection cable (e.g. USB) you can remove the memory card and attach it to a memory card reader inserted into the Raspberry Pi. If you use this approach, then the memory card will be mounted as a mass-storage device (typically the mount point shows up under the /media path).

  • THis is an old camera powershot a620(~ 2005). I need to eject it to let gphoto2 have access to it. – bakalolo Mar 19 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.