Copyright © 2014 jsd
In a great many situations, the most convenient ways to transfer files between a Linux system and an Android phone is via USB.
First, hook up the cable.
To find out what is going on, use the command cd /dev/disk/by-id/; ls -al. There will be many lines of output. With any luck, you will see a line like this:
lrwxrwxrwx 1 root root 9 Mar 26 14:22 usb-HTC_Android_Phone_SH16MT501921-0:0 -> ../../sdc lrwxrwxrwx 1 root root 10 Mar 26 14:22 usb-HTC_Android_Phone_SH16MT501921-0:0-part1 -> ../../sdc1
The foregoing means that the phone is in disk-drive mode (not charge-only mode) and is ready to mount.
In contrast, if you see something like the following, it means the phone is in charge-only mode (not disk-drive mode).
lrwxrwxrwx 1 root root 9 Mar 26 08:36 usb-HTC_Android_Phone_SH16MT501921-0:0 -> ../../sdc
To change modes, touch the bar at the very top of the phone, then drag it down. There should be an item with a pitchfork-shaped USB icon. Tap on that item, and select the desired mode.
Once you have the phone in disk-drive mode, create a mountpoint install -d /mnt/phone and then mount the device mount /dev/sdc1 /mnt/phone. You know the correct device based on the output of the ls command, above. In our example, the device is /dev/sdc1.
You can make things even easier for next time if you fix up your /etc/fstab. First, find the UUID associated with your SD card.
cd /dev/disk/by-uuid/ ls -al | grep sdc1 lrwxrwxrwx 1 root root 10 Mar 26 14:22 6163-3439 -> ../../sdc1
Then add the following line to your /etc/fstab:
UUID=6163-3439 /mnt/phone vfat user,noauto 0 0
From now on, all you have to do is hook up the phone, put it into disk-drive mode, and then type mount /mnt/phone.
Whenever you want to unmount it, the command is umount /mnt/phone ... and you should always unmount it before unplugging the cable.
There is one slightly tricky point: If you look at the output of the lsusb command, you might think the connection is not working even when it is. There is an important distinction between “charge only” mode and “disk drive” mode. However, lsusb alleges that the phone is in charge mode, even when it’s not. It is a simple matter to ignore what lsusb is saying about this.
In some unusual situations, for instance if you don’t have a USB cable handy, you can just take the SD card out of the phone and mount it directly on your computer. Many laptops come with a build-in reader that accepts full-sized SD card ... and will accept micro-SD cards with a suitable adapter.
Note that the /etc/fstab line discussed in section 1 handles this case as well. The UUID is the same either way. The UUID is associated with the SD card, not with the phone itself.
Copyright © 2014 jsd