I have a Moto G (2nd generation) with Android 5.02 on it. Internal SD card is about 8Gb and I have an external SD card with 16Gb free space.

Moving application to SDCARD from the application's menu moves it to sdcard0 which is the internal SD card.

Adb shell command:

pm get-install-location

gives me:


I tried to set installation location through:

pm set-install-location 2

But I'm getting this error:

Error: java.lang.SecurityException: Package android does not belong to 2000

That is I believe complaining about root permissions.

And because it's a production build trying:

adb root

gives me:

 adbd cannot run as root in production builds

Is there any way to set the applications install their data to external SD card?

P.S: I don't want to install a custom rom or install third party software to root the phone.

Edit: I've noticed that applications data was stored in the folder /storage/sdcard0/Android, so I thought of moving this folder to /storage/sdcard1/ and creating a symlink this way instead:

ln -s /storage/sdcard1/Android /storage/sdcard0/Android

will this do the job?

Thank you.

5 Answers 5


Basically speaking: You can't. At least not without rooting.
The main reasons Android does not allow you to install an application to your external SD card are:

  1. Security: It's the main reason for that restriction. Basic file systems like NTFS or FAT (any version of it) do not allow for Unix-like permission management.
    This means: any application would be able to write to any file on that storage.
    Thinking of malicious apps, they would be able to replace proper apps with fake/infected ones, bricking your phone and rendering it unusable.

  2. Volatile storage: Your external SD card is not safe to be inserted in your device all the time. You are able to eject it any time what makes your SD card not a very good candidate for a permanent storage. Consider apps running off of your SD card and you eject it. Those apps will just crash and all other apps saved on your SD card are gone as well. You can't use them at that time and the data of those app is also affected by reason #1.

  • I have a linux background so I've considered this approach: I've noticed that the application's menu option "Move to SDCARD" created a folder called Android on sdcard0 (the internal one) with applications data on it; will creating a symlink (in sdcard0) called Android to a folder called Android in sdcard1 work?
    – pr.nizar
    Apr 20, 2015 at 18:26
  • The issue is: Android stores only application data and obb in /sdcard/sdcard0/Android. Applications are stored in a hidden folder called .android_secure where not even root has access to (I tested it on my device, you can't evencd to that folder).
    – GiantTree
    Apr 20, 2015 at 18:49
  • Actually that's precisely what I need! The main problem getting me thinking of this is the data especially with heavy games.. The main applications are not that big compared to the data they add later. So you think it might work?
    – pr.nizar
    Apr 20, 2015 at 18:57
  • If it is only data or obb then it certainly works. At least on Android versions that do not make sdcard_rw belong to the root group or feature the user sdcard_rw at all. But with a bit of permission changes you should be able to get that sorted out.
    – GiantTree
    Apr 20, 2015 at 19:00
  • Running ls -l /storage/sdcard0 gave me this lrwxrwxrwx root root 2015-04-20 15:59 sdcard0 -> /storage/emulated/legacy and running ls -l /storage/sdcard0/ gave me this drwxrwx--x root sdcard_r 2014-12-20 18:16 Android.. Is that a good or bad news? Since I'm not root I believe I can not set permissions.
    – pr.nizar
    Apr 20, 2015 at 19:06

Basically you can! ;)

  • First, Root your phone!
  • Second, Create a secondary partition in your SD card (Ext.4) >= 2GB and set it as primary.
  • Third, download and install Link2sd app from playstore. Open the app, and I will ask you to create a mount point to your 2nd partition. Select Yes. Reboot.

After reboot, EVERY app you install will automatically go to SD card.

If you don't know how to create partition search for a guide in Google there are plenty of them

  • That's actually what's I'm trying to avoid: installing third party software. :-)
    – pr.nizar
    Apr 20, 2015 at 18:28

That was quite a journey searching for an answer not involving rooting but I ended up:

  1. Unlocking my bootloader

  2. Booting on TWRP without installing it:

    fastboot boot recovery.img
  3. Installing Chainfire's SuperSU with TWRP.

  4. From Terminal Emulator or adb's shell:

    pm set-install-location 2
  5. From an application's menu in Settings > Applications just pushing Move to SDCARD moves it* - its data and obb - to the external SDCARD.

  6. Removing SuperSU......

Full unroot

Nah... I didn't do that! 3:)


Go to this address http://developer.android.com/tools/help/shell.html#shellcommands

Android 5 and above does not support this pm get-install-location

Try to backup your apk and follow the steps bellow

adb shell pm install -r -s <path of your apk>


adb shell pm install -r -s /storage/sdcard1/base.apk

-r means reinstall apk with existing data and -s means sdcard


First install Adbd insecure (apk download from xda-developers).

Once installed on your device, open it and mark the box: "Enable insecure adbd".

Now you can change the location to install your apps.

You must log in to answer this question.

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