Can you just "pull the plug" on MTP devices?
Solution 1:
When you plug in a USB mass storage device
, it gives the host computer undifferentiated access to the mass storage.
It assumes absolute control over the file system similar to that of a hard drive.
As such, unless explicitly commanded by the host system to sever the connection between the devices there is a chance that the host computer might corrupt the file system. Hence the "Safely Remove Hardware and Eject Media"
message.
However, MTP
, or Media Transfer Protocol
, operates at the file level rather than as a large unit of mass storage at the block level.
When plugging in a device such as a MTP device, the host system queries the files on the device.
This is often maintained as a database or index on the root file system of the MTP device. The MTP device's system does not have to re-scan the entire device when its content is modified; it only needs to update the database/index.
The host system can then download a file, a signal will be sent to the device to acknowledge this request.The requested file will sent by the device.
Deleting files work much the same way. The host system sends a message to the device, marking a file for deletion. The device removes the file upon acknowledging the signal.
This works much like a transactional file system, where either the file is modified or it is not. The storage will not be affected by failed transfer.
This is also the reason why MTP only allows one file transfer at a time (atomic file transfer), such that corruption cannot occur as operations are run sequentially.
So yes, you can just pull the plug on your device.
Further reading about MTP, and comparisons to USB Mass Storage