[Samsung Galaxy S7 Guides, News, & Discussion] brotbuexe:
There is still something wrong with this guide and/or the behaviour of samsungs calculation ending up in "internal storage full" notifications.

Android says at https://source.android.com/devices/storage/adoptable.html that the feature just replaces the internal /sdcard with the external /sdcard. That makes the space which is used for the internal /sdcard available for the rest of /data.

I did the sm stuff at the beginning and once did the "migrate data".

I now have a "32gb" internal which is full somehow, and a 200gb sdcard which has 52gb data on it.

When I try the "migrate data" from within the internal data, it starts but it suddenly stops at around 30%.

Now /data/data is internal. /storage/emulated/0/ is the new external storage.

2000@herolte:/ $ sm list-volumes all
emulated:179,2 mounted null
private mounted null
private:179,2 mounted 66cfe4d5-bc6c-4788-b63a-d856a1600d35
emulated unmounted null
privatemode unmounted null

2000@herolte:/ $ mount
/dev/block/dm-0 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,debug_bdinfo,data=ordered)
...
/mnt/expand/66cfe4d5-bc6c-4788-b63a-d856a1600d35/media on /storage/emulated type sdcardfs (rw,seclabel,nosuid,nodev,noexec,relatime,low_uid=1023,low_gid=1023,gid=1015,multi_user,mask=0006,reserved=20MB)

df -h /data
Filesystem Size Used Available Use% Mounted on
/dev/block/dm-0 24.8G 24.3G 466.9M 98% /data

df -h /storage/emulated
/mnt/expand/66cfe4d5-bc6c-4788-b63a-d856a1600d35/media
181.9G 52.4G 129.5G 29% /storage/emulated

du -d 1 -m /data | sort -n
...
10205 /data/app
11274 /data/media
1505 /data/dalvik-cache
1803 /data/data

So we have 10gb apps, 11gb media, 1,5gb dalvik, 1,8 data

I understand apps, dalvik, data. But where does the 11gb media come from? Shouldn't the media be all on the "internal sdcard" which is now the external sdcard...

du -d 1 -m /data/media/0/Android/data | sort -n
443 /data/media/0/Android/data/com.spotify.music
768 /data/media/0/Android/data/au.com.shiftyjelly.pocketcasts
9766 /data/media/0/Android/data/com.samsung.vrvideo

Why would the data still be on data instead of /sdcard/Android/data?

du -d 1 -m /storage/emulated/0/Android/data | sort -n
162 /storage/emulated/0/Android/data/com.samsaodev.oobe
768 /storage/emulated/0/Android/data/au.com.shiftyjelly.pocketcasts
9767 /storage/emulated/0/Android/data/com.samsung.vrvideo

Some of them already is there. Maybe from the failed migration before?

ls -l /storage/emulated/0/Android/data/com.samsung.vrvideo

drwxrwx--x 3 10427 1015 4096 Apr 22 22:51
drwxrwx--x 2 10427 1015 24576 Apr 23 18:01
-rw-rw---- 1 10427 1015 17405 Apr 22 22:51
-rw-rw---- 1 10427 1015 19077 Apr 22 22:52
-rw-rw---- 1 10427 1015 20039 Apr 22 22:52
-rw-rw---- 1 10427 1015 20736 Apr 22 22:52

ls -l /data/media/0/Android/data/com.samsung.vrvideo

drwxrwxr-x 2 1023 1023 4096 Apr 23 18:47
drwxrwxr-x 2 1023 1023 20480 Apr 23 18:01
-rw-rw-r-- 1 1023 1023 17405 Apr 22 22:51
-rw-rw-r-- 1 1023 1023 19077 Apr 22 22:52
-rw-rw-r-- 1 1023 1023 20039 Apr 22 22:52
-rw-rw-r-- 1 1023 1023 20736 Apr 22 22:52

same filesnames, same size, etc.

lets try and delete the files on the "sdcard".

They are gone on the other path too. So its just a symlink.

BUT, Samsung calculates this as used internal storage.

Recap:

root@herolte:/ # df /data/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-0 26018880 25524412 472964 98% /data

This it how it shows in Samsung storage properties.

And /data/media is the same content as /storage/emulated/0

But it should not be counted on the /data usage size it it is or should be on the sdcard.

Anyone have any idea how this could be fixable. It's fun to have a big "internal" sdcard but if data is still filled because of this issue...

I compared this with my shield tv, which has a sdcard and adoptable storage too. There the /data/media/0 isn't used anymore, there is nothing in it. Instead only /storage/emulated/0 is there. Maybe we just have to disable the "mirror view" in /data/media/0.

The shield tv (or android) has another great feature. You can still move apps directly inside the app details between the storages (its great for big games)...

Some comparison on the disks and mounts:

S7 /dev/block/dm-0 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,debug_bdinfo,data=ordered)
S7 /dev/block/dm-1 on /mnt/expand/66cfe4d5-bc6c-4788-b63a-d856a1600d35 type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime)
Shield no /dev/block/dm-0
Shield data comes from: /dev/block/platform/sdhci-tegra.3/by-name/UDA on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,data=ordered)
Shield /dev/block/dm-0 on /mnt/expand/0d26b153-1334-4f53-8f40-2f54a4162c6c type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime)

S7 /mnt/expand/66cfe4d5-bc6c-4788-b63a-d856a1600d35/media on /storage/emulated type sdcardfs (rw,seclabel,nosuid,nodev,noexec,relatime,low_uid=1023,low_gid=1023,gid=1015,multi_user,mask=0006,reserved=20MB)
Shield /dev/fuse on /storage/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)

I don't have any experience with this stuff, it just looks completely different for me.

Some background: http://nelenkov.blogspot.de/2015/06/decrypting-android-m-adopted-storage.html

Maybe we are missing the encryption?

Some more stuff on https://source.android.com/devices/storage/config.html

"To indicate an adoptable storage device in the fstab, use the encryptable=userdata attribute in the fs_mgr_flags field."

On the shield tv /fstab.foster_e:

/devices/platform/sdhci-tegra.0/mmc_host* auto vfat defaults voldmanaged=sdcard1:auto,encryptable=userdata
/devices/platform/tegra-xhci* auto vfat defaults voldmanaged=usbdrive:auto,encryptable=userdata
/devices/tegra-ehci* auto vfat defaults voldmanaged=usbdrive1:auto,encryptable=userdata

Samsung /fstab.samsungexynos8890

/devices/15740000.dwmmc2/mmc_host/mmc* auto vfat defaults voldmanaged=sdcard:auto
/devices/15400000.usb/15400000.dwc3/xhci-hcd.2.auto/usb* auto auto defaults voldmanaged=usb:auto

Now lets see what the os says:

1|root@herolte:/ # sm has-adoptable
false
root@herolte:/ # sm list-disks adoptable

vs.

130|root@foster:/ # sm has-adoptable
true
1|root@foster:/ # sm list-disks adoptable
disk:179,32

When I kill the sdcard, I still see the content in /data/media/0/. So it is not migrated at this point.

New try:

sm set-force-adoptable true
sm partition disk:179,0 private

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-1 190719752 40 190703328 0% /mnt/expand/00955fca-183e-4f53-81f6-44830a913cba

root@herolte:/ # df /data/media/0
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-0 26018880 25834856 162520 99% /data

At this state, the properties on the device storage says I use 7gb system, 13gb "used", 10gb "other". And I can open it and see android/data filled with stuff.

On this side nothing changed.

If I go to the sdcard and say migrate, it says it could move 10gb of data.

While it moves the data you can see it is copied to /mnt/expand/00955fca-183e-4f53-81f6-44830a913cba/media/0/ (which was empty before after the sm partition).

So it copies at this point all from /data/media/0 to /mnt/expand/00955fca-183e-4f53-81f6-44830a913cba/media/0/

At this time the storage is mounted like this:

/mnt/expand/00955fca-183e-4f53-81f6-44830a913cba/media on /storage/00955fca-183e-4f53-81f6-44830a913cba type sdcardfs

At the end it goes like before to

/mnt/expand/00955fca-183e-4f53-81f6-44830a913cba/media on /storage/emulated type sdcardfs

All looks fine, but it still does not kill the data on the internal storage.

But in the end it seems like it worked.

11269 /mnt/expand/00955fca-183e-4f53-81f6-44830a913cba/media/0/Android/data

root@herolte:/ # du -d 1 -m /data/media/ | sort -n
0 /data/media/

And now I have 10GB data on the internal storage back.

Let's see if this keeps that way.

Only difference this time was I forced the "adoptable" storage before. But I doubt it was the solution.

How is it working for you guys?