BBCode Spoiler CSS Class

Monday, 21 July 2014

Android Tutorial: How do I Map a Drive Letter to my MTP or PTP Android Device?

Some Back-Story: How I Got my Unrecognized Samsung Galaxy S3 to Connect to Windows 7 As a Portable Device

The other day, after changing configurations on neither my phone nor my laptop, my phone stopped being recognized by my laptop's windows 7 environment. Naturally, I went through this checklist:
  1. Try a different USB port -- Still broken.
  2. Restart the phone -- No luck.
  3. Restart the computer -- Nada.
  4. Reinstall the phone's USB drivers -- Zilch.
  5. Fully uninstall, then reinstall all USB bus and device drivers -- Painful, and still ineffective.
Dejected, I turned to the internet and found a post on some Android support forum suggesting I try physically removing the battery from my cellphone and then re-inserting it.

Somehow that fixed it. But why was my phone unrecognized in the first place?

Why Would I Want or Need To Map A Drive Letter To My Android Phone's Filesystem?

Before my phone stopped being recognized, it gave me a few messages warning about low-disk capacity. My usual approach to disks being full is running the amazingly useful open-source disk-space visualization tool WinDirStat.
WinDirStat gives you a visual representation of the space on your drive

There's a hitch though: WinDirStat can only map drives with a drive letter, and all reasonably new Android devices mount as a 'Portable Devices', not as storage volumes:
Note how the phone is listed as a 'Portable Device' instead of a regular drive

For technical (and well thought out) reasons, modern Android devices connect to the computer by either Picture Transfer Protocol (PTP, a protocol also employed by many digital cameras) or Media Transfer Protocol (MTP, an extension of PTP to accommodate arbitrary media), when connected via USB.  A limitation of this protocol is that directories do not contain meta-information about their content, so folders do not show a Size in Windows. WinDirStat is needed, because it will probe the directories for you and graphically show their content.
Windows Explorer fails to show any folder size information.
So my quest became one step more convoluted:
  1. Find a way to map my phone's filesystem to a disk letter.
  2. Use WinDirStat to analyze my disk usage.

How NOT to Map Your Phone's Filesystem to a Drive Letter (An Introduction to WinObj.exe, SUBST, SUBST4NT.exe and Hardware ID's in Windows)

On the advice of WinDirStat's package maintainer, I got it in my head that if I could just find the handle being used by Windows to address the hardware address of my phone, then I could manually map that handle to a disk letter using NTSUBST.exe.

A Brief History Lesson on SUBST, NTSUBST.exe and SUBST4NT.exe 

There is an oft-forgotten CMD utility in Windows called SUBST. It is used to map arbitrary disk locations to drive letters. For instance:
SUBST X: \Windows\System32\drivers\etc
Creates a new drive letter, X, which points to the host file folder. To remove the mapping, use:
This is very useful, but has some limitations, so a more robust utility was created, NTSUBST.exe. NTSUBST allowed users to map virtually any directory, device or network location to a drive letter, but has in recent years been wiped from the internet.

After many hours of looking for a working version of NTSUBST.exe, I emailed WinDirStat's package maintainer in desperation: since he had suggested NTSUBST.exe, maybe he would be able to provide a copy if I asked nicely... He did one better! He introduced me to SUBST4NT.exe, a tool which accomplishes the same feat. as NTSUBST, but with the benefit of existing on the interent at all. I was stoked.

Until I tried it out and it didn't work. Then I was choked.

How You Really Can (But Probably Shouldn't) Give a PTP Device a Drive Letter

It turns out that you REALLY can't treat an MTP device as a regular drive... but there is some impressive work toward making a read-only PTP drive letter encapsulation tool worth mentioning: They only provide trial software, and it seemed to lag infinitely while trying to deal with my MTP cellphone, but this software really does do what it says on the tin.

The Best Way To Map Your Android To A Drive Letter

There's more than one way to skin a cat... since my goal is simply to have my phone as a drive letter, I don't necessarily need to do that via USB. By mapping a network drive to your phone, you can access all of your files, and as a bonus, you don't need to be plugged into the computer! You have a couple options in servers for your phone:
  1. Samba File Servers -- This type of server will let you connect to your windows home-group network.  It will work very well if you have a network set up already, and may be a perfect solution.
  2. WebDAV File Servers -- This is Samba's cousin, minus the home-group network.  It simply serves your files on a network address (the ip of your phone, on some configurable port).
I will not give any specific suggestions for apps, as what is good for me may not be for you. Take notice that many of these servers require your Android to be rooted.

Once you have a server set up on your phone, setting up a network drive pointing to it is easy:
Open "Computer" in Windows Explorer and press "Map network drive"
If everything worked, then you'll now have your phone mapped to a drive letter!
How will you make the most of your new file server?


  1. Great post, exactly what I was looking to do! Really boiled it down and although I was aware of the subst command you took it to the logical extension. Nice work!

  2. Windirstat is always on a Flash drive, my cell phone, etc to help diagnose these giga/tera bytes mysteriously consumed by some app, on by Windows (folder winsxs, typically containing 50 thousand files, 20 to 39 Gig).

    Once I find where are the useless files, I use a second tool which also need drive letter to work : ZTreeWin. It emulate the retro look of ZtreeGold for DOS. But it is a real win32 app, able to read all folders/files (half a million files can be read in 30 seconds when already in cache or with SSD drive) and show all as if in a single folder, allowing to see the biggest, most recent and any other sort option.

    1. Good tip! I'm going to add ZTreeWin to my bag of tools too.

  3. the problem already solved. So it turned out it was possible actually... ;-)

    1. Way to expensive though. In fact it's quite ridiculous that we need to pay a third party for basic functionality. Did you pay for it if so be a nice guy and share your registration key.

      Anyway the article may say: "For technical (and well thought out) reasons, modern Android devices connect to the computer by PTP or MTP when connected via USB."

      Those well thought out reasons are only commercially motivated. As this whole shitty MTP system only serves to DRM crap or have a 'walled off garden'.