2

I have a mobile device attached via USB to a Linux box and wish to unmount it. I ran the command fdisk -l however it does not list a mount point. I then ran the command lsusb which yielded the screenshot below.

enter image description here

I then proceeded to search the /dev/disk/by-id directory and was found the following file

enter image description here

The file is a symbolic link to what appears to be /dev/sdc

enter image description here

Questions

  1. Why does it not appear when I run the command fdisk -l?
  2. How do I unmount it properly without simply yanking the USB cord from the USB port?

3 Answers3

1

Many USB devices appear as disk devices. When they are connected, the system sets up the plumbing to allow the device to be mounted. Depending on the configuration of auto-mount tools the device may or may not be mounted. In your case the device has been configured as a disk /dev/sdc, but appears not to have been mounted. When you unplug it this mapping will be removed.

You can safely unplug the device and the system will cleanup the entries associated with the device.

Even if the device were mounted, it is usually safe to simply unplug it. The auto-mount software will simply unmount the device and the rest of the cleanup will occur automatically. It is unsafe to the device to unmount it if their are pending changes to the disk partition(s). These are generally done within a few seconds of the change. If auto-flush is enabled, the time is less, but the wear on flash devices is higher.

EDIT: fdisk -l doesn't see the device because the system is not aware of any partitions on the device. It is possible that the device is formatted but not partitioned, or that it is neither partitioned nor formatted. If any partitions had been recognized you would have a device like /dev/sdc1 where the number is the partition number.

As you provided enough information to determine that you had a phone, I could safely assume that it was not a hard disk drive. Hard disks can have problems if power is suddenly removed, especially if they are in the middle of some action. The manufacturer should provide documentation on how to safely power down the drive. This may include actions like those specified in the post. Normally, parking the heads should be sufficient, but there may be fragile devices which require additional steps. If the disk has spun down, then it is likely ready to be unplugged.

The post comments about ensuring that I/O is complete are relevant, but as you had not mounted the device, that was also irrelevant in this case. The comments about allowing some time after I/O before unplugging the device allows for the I/O to complete.

For a device which is only plugged in to charge, unplugging it should have no more impact than unplugging it from its wall wart. The battery will take over as the power source. I have several devices that I charge this way. The one issue is whether the USB port provides enough power to charge the device while it is being used. Some of my devices won't run while connected to power which solves that problem.

BillThor
  • 11,345
  • 2
  • 28
  • 25
1

It's not your cards data partition shown there (that would be /dev/sdc1), but just the card. Since you decided to connect your device for charging only, Android kept the card mounted (and locked) on the device itself. Hence the computer can see the device (card, /dev/sdc), but cannot access the partition (/dev/sdc1). For the same reason, fdisk -l cannot see the partition, and thus doesn't list it.

To your second question: As you didn't mount it, you do not need to unmount either.

Izzy
  • 3,775
0

Apparently you have connected your device to charge only and have not enabled 'USB Storage' mode on the phone. That means, no partitions were mounted, so there is nothing to unmount.

In the case when you enabled USB storage mode then most likely your system will mount the sdcard and you will be able to browse it with a file manager on your box. In that case you can unmount the sdcard by clicking the triangle icon next to the device name in file manager (e.g. pcmanfm, nautilus, etc). Or you could do that from a console using something like sudo eject /dev/sdb. Type mount on its own to see the correct device name.

ccpizza
  • 8,241