I created an AVD using
bin/avdmanager create avd -d "Nexus 5" -c 2G -n nexus_5 -k "system-images;android-29;google_apis;x86_64"
The -c 2G
is supposed to create a 2GB sdcard.
When I boot the emulator, however, /sdcard
seems to point to internal storage on /data/media
rather on the 2GB disk:
$ adb shell df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 996M 604K 996M 1% /dev
tmpfs 996M 0 996M 0% /mnt
tmpfs 996M 0 996M 0% /apex
/dev/block/dm-2 2.4G 2.3G 64M 98% /
/dev/block/dm-1 124M 123M 444K 100% /vendor
/dev/block/vdc 775M 302M 473M 39% /data
/data/media 775M 302M 473M 39% /mnt/runtime/default/emulated
/dev/block/vold/public:253,80 1.9G 532M 1.4G 27% /mnt/media_rw/1400-1801
/mnt/media_rw/1400-1801 1.9G 532M 1.4G 27% /mnt/runtime/default/1400-1801
$ adb shell ls -l /sdcard /storage/self/primary /mnt/user/0/primary
lrwxrwxrwx 1 root root 19 2020-12-01 13:29 /mnt/user/0/primary -> /storage/emulated/0
lrw-r--r-- 1 root root 21 2020-07-21 03:02 /sdcard -> /storage/self/primary
lrwxrwxrwx 1 root root 19 2020-12-01 13:28 /storage/self/primary -> /mnt/user/0/primary
$ adb shell mount | grep storage/emulated
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal)
When I try to adb push
data to /sdcard
this fails because there’s not sufficient space available (on internal storage).
How can I tell the emulator to use the external sdcard instead?
/sdcard
isn't physically external SD card. It's a symlink to primary emulated external shared storage. See details in https://android.stackexchange.com/a/218469/218526, https://android.stackexchange.com/a/205494/218526 and https://android.stackexchange.com/a/218338/218526 – Irfan Latif Dec 01 '20 at 13:26