mtp-mount
Mount MTP devices as local filesystems via FUSE.
Plug in your Android phone or camera, run mtp-mount /mnt/phone, and use
ls, cp, cat, rm, etc. on your device's storage. Built on
mtp-rs (pure Rust, no libmtp) and
fuser.
Install
Usage
Mount the first available MTP device:
Pick a specific device by serial number:
Mount read-only:
Unmount:
Run mtp-mount --help for the full list of options.
Supported operations
- Read:
cat,cp,head,less, etc. - Write: create files, overwrite existing files
- Directories:
ls,mkdir,rmdir - Delete:
rm - Rename/move:
mv
Not supported
MTP is an object-based protocol, not a block device. Some POSIX features don't map:
- Hardlinks and symlinks
- File permissions (
chmod/chownare no-ops, everything shows as 0644/0755) - Extended attributes
- Sparse files or random-access writes (files are uploaded whole on close)
How it works
The FUSE layer translates filesystem calls into MTP operations:
- Reads stream from the device to a temp file, then serve from disk (no full-file RAM buffering)
- Writes buffer to a temp file, then flush to the device on close
- Overwrites use a safe upload-then-delete-then-rename sequence when the device supports rename, so data is never lost if the upload fails
- Directory listings are cached per session and refreshed on
opendir
Requirements
You need a FUSE implementation:
- Linux:
sudo apt install libfuse3-dev(Debian/Ubuntu) orfuse3(Fedora/Arch) - macOS: macFUSE or FUSE-T (may need manual
pkg-configwiring)
Build from source
Testing
Unit tests run without FUSE:
Integration tests mount a virtual MTP device via FUSE (Linux only, needs libfuse3-dev):
All 43 tests (28 unit + 15 integration) pass on Linux. The integration tests
use mtp-rs's virtual device transport, so no physical device is needed.
License
MIT OR Apache-2.0