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

Robert
  • 20,025
  • 6
  • 47
  • 66
Androidquery
  • 467
  • 1
  • 5
  • 19

1 Answers1

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
alecxs
  • 4,034
  • 3
  • 16
  • 34
  • 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 04 '20 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 – Androidquery Jan 06 '20 at 04: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 – Androidquery Jan 06 '20 at 04:10
  • 1
    @Androidquery just install Link2SD – alecxs Jan 06 '20 at 08:16
  • @Androidquery as suggested by alecxs go with Link2SD. Setting up manually requires some advanced skills you may not feel comfortable with. – Irfan Latif Jan 06 '20 at 10:49
  • https://android.stackexchange.com/q/219678 – alecxs Jan 08 '20 at 13:44
  • create some file on your MicroSD Card with dd + mke2fs (see link) 2. create mount script in '/su/su.d' (see above example '40sdextimg') 3. create empty folder '/data/sdext2' (mount point for Link2SD) 4. reboot and check Link2SD storage info (invite me to some chat if you need more help)
  • – alecxs Sep 26 '21 at 18:31