0

I have seen option of making external sd card to internal in android 6 mobile phones but i have android lolipop 5.1.1 how can i make it adoptable or get that option is it feasable to get that option i found some commands but that command is not found in my /system/bin even after rooting to

sm has-adoptable 

sm set -force- adoptable true

/sbin/sh: sm: not found

can i find some sm binary and use it ..i tried but my phone got problem

8
  • 1
    You can't. That feature was only introduced with Android 6 and doesn't exist before that.
    – Izzy
    Jan 3, 2020 at 7:33
  • have you considered installing custom rom (if any)?
    – alecxs
    Jan 3, 2020 at 8:52
  • 2
    Duplicate of android improve internal storage Jan 3, 2020 at 10:07
  • 1
    @Androidquery if you make a quick web search you'll get hundreds of results discussing Adoptable storage was introduced in Android 6. Storage Manager (sm) is deeply integrated with other parts of Android code. It's not a standalone command, so can't be used independently. That's explained in the accepted answer to linked question. Jan 3, 2020 at 12:10
  • 1
    @Irfanlatif it was not clearly said in any posts that it will not work so i confirmed it with this post becoz once trying sm command my android had been crashed i have to recover it from images so confirming before trying again ... thanx irfan Jan 3, 2020 at 12:18

1 Answer 1

4

sm is actually not a binary, it is a shell script for java program which does not exist/work on 5.1-lollipop

# Script to start "sm" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/sm.jar
exec app_process $base/bin com.android.commands.sm.Sm "$@"

to answer the headline

a completely another solution for rooted devices only:

you can mount ext4 disk image (or ext4 partition) with same permissions like /data
(mount script example)

/su/su.d/40sdextimg start-up script with executable permissions

#!/system/bin/sh
until grep -qw /data/sdext2 /proc/mounts
  do
    mount -t ext4 -o loop,rw,nosuid,nodev,noatime /storage/31D1-1308/data.sdext2.img /data/sdext2
    sleep 1
done &

then you can move apps and create symbolic links
(that's what Link2SD does)

mkdir /data/sdext2/com.textra-1
mv /data/app/com.textra-1/base.apk /data/sdext2/com.textra-1/
ln -s /data/sdext2/com.textra-1/base.apk /data/app/com.textra-1/base.apk

or bind mount whole folder
(assuming 2nd partition is mounted /data/sdext2)

mkdir /data/sdext2/media
chmod 0770 /data/sdext2/media
chown 1023.1023 /data/sdext2/media
chcon u:object_r:media_rw_data_file:s0 /data/sdext2/media
mv /data/media/. /data/sdext2/media
mount -o bind /data/sdext2/media /data/media
7
  • 1
    it's of course easier, moving whole folders is possible with same command. on per-app-selection is what Link2SD provides, for better performance and stability one should avoid moving critical apps to external sd as much as possible. i recommend moving apk only
    – alecxs
    Jan 4, 2020 at 12:06
  • @alecx will these scripts to start sm to shell will work on android lolipop 5.1.1 as previously i pushed sm and sm.jar file downloaded from a site of different device and tried it gave java class error then ABORTED error crashed the android and i had to recover through system and other images...will this work and not damage the phone or os again.... as irfanlatif commented that adoptable storgae has been introduced and work on only Android 6.0 and above Jan 6, 2020 at 4:07
  • @IrfanLatif An even simple approach is to mount SD card 2nd partition (or a loop file from first partition) directly to /data/app (or /data/data or /data/media). No extra steps required. But this should be..... kindly modify the script and tell me detailed steps to this simple approach script Jan 6, 2020 at 4:10
  • 1
    @Androidquery just install Link2SD
    – alecxs
    Jan 6, 2020 at 8:16
  • @Androidquery as suggested by alecxs go with Link2SD. Setting up manually requires some advanced skills you may not feel comfortable with. Jan 6, 2020 at 10:49

You must log in to answer this question.

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