Linux with Android MTP

Linux with Android MTP

Oleg Goldshmidt pub at goldshmidt.org
Thu Oct 24 09:09:54 IDT 2013


"E.S. Rosenberg" <esr+linux-il at g.jct.ac.il> writes:

> Always unmounting properly is obviously best practise but isn't the
> whole point of mtp that unmount isn't strictly needed since you are
> not interacting with the fs but rather with some daemon on the device,
> so worst that can happen when you unplug is a corrupt file?

As far as I understand MTP is supposed to act as a transactional
filesystem, i.e., if you want to modify a file you operate on a copy and
then write the whole file or nothing. Potentially slow, of course. The
actual filesystem is implemented on the device and not on the host. This
indicates - theoretically! - that you may be right.[1]

I *read* that Google's MTP implementation on Android extends the
standard to avoid the potentially expensive copying of whole files back
and forth.[2] If that is the case then maybe properly unmounting is
prudent, after all. Maybe (I do not *know*) you still cannot damage the
filesystem itself, but you *may* be able to corrupt files.

Disclaimer: I don't really know the details - do not believe my words
without checking on your own.

[1] This also means, I *suppose*, that fsck on the host will not help
    you out if the filesystem on your device gets corrupted.

[2] It is not clear to me whether all the Android manufacturers
    implement these extensions. Again, I *read somewhere*[3] that
    Samsung do not.

[3] Oh, hell, what is Google for? http://intr.overt.org/blog/?p=174 -
    NB: this is the GNOME/GVFS guy, simple-mtpfs may be different.

-- 
Oleg Goldshmidt | pub at goldshmidt.org



More information about the Linux-il mailing list