1

In Marshmallow (and consequently in CM13), the external SD card is mounted at a path that contains its serial number. I have a bunch of Tasker tasks, the occasional script, and lots and lots of apps configured with a specific path to the external SD card (in my case, /external_sd because that's where it was in CM12).

Is there anything sensible I can do about this change in Marshmallow? Fixing paths everywhere just because I've upgraded to a faster/larger SD card (which has a different serial number) is not going to be fun.

How would I go about making the external SD card available under "/external_sd" on CM13/Marshmallow?

2 Answers 2

2

I've found a reasonably easy way to do something close enough: just set the volume serial number to something fixed. This is easy enough for FAT32-formatted SD cards: just use Sysinternals VolumeID:

D:\>vol D:
 Volume in drive D has no label.
 Volume Serial Number is 07F5-432C

D:\>volumeid D: ECAD-ECAD

VolumeID V2.01 - Set disk volume id
Copyright (C) 1997-1999 Mark Russinovich
Sysinternals - www.sysinternals.com

Volume ID for drive D: updated to ecad-ecad

("ecad" for "external card" but there are other possibilities, of course)

Now my external SD card is mounted at /storage/ECAD-ECAD, which is easy to remember for typing in those apps which don't let me pick a path, and more importantly, can stay the same when I upgrade to a faster card, for example (if I repeat this procedure).

The only complication is SD cards larger than 32 GB, which Windows refuses to format into FAT32. The best tool to work around this is Rufus, an open-source tool with a focus on bootable drives, but it can also just format a large FAT32 drive.

1

Another option would be to use a init.d script to re-create the sdcard link.

#!/system/bin/sh

SERIAL=`ls /mnt/media_rw/ | head -n 1`
FULL_PATH="/mnt/media_rw/$SERIAL"
SERIAL_LENGTH=${#SERIAL}
LINK_NAME="/external_sd"

if [ -e $LINK_NAME ] ; then
    echo "Link already exists!"
elif [[ $SERIAL_LENGTH -lt 1 ]] ; then
    echo "Badly formed path!"
elif [ ! -d "$FULL_PATH" ] ; then
    echo "SdCard path not found!"
else
    mount -o rw,remount /
    ln -s $FULL_PATH $LINK_NAME
    mount -o ro,remount /
fi

This script assumes:

  • that init.d scripts aren't being blocked by SEAndroid,
  • that your device needs to be turned off to change the sdcard, and
  • that it only has space for one sdcard.

I assume the reason for the introduction of serial numbers in the sdcard path is for devices with space for more than one sdcard.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .