[Samsung Galaxy W I8150] m4g4:
Adopted storage broken because of kernel CONFIG_EFI_PARTITION is not set

Cannot use the external SD card as adopted storage with the CM-13.0-2016-10-22-UNOFFICIAL.zip image installed.

GUI symptoms.

The wizard "Set up your SanDisk SD card" to "Use as internal storage" complains the SD is slow, then fails to move files to the external storage.

Under

Settings | Storage & USB​

the card is said to be "corrupted".

Command line symptoms

Looking at logcat output corresponding to the adoption wizard run, there is

12-24 22:47:26.842 162 186 I mkfs.f2fs: F2FS-tools: mkfs.f2fs Ver: 1.6.1 (2016-03-22) [modified by Motorola to reserve space]
12-24 22:47:26.842 162 186 I mkfs.f2fs: Info: Debug level = 0
12-24 22:47:26.842 162 186 I mkfs.f2fs: Info: Label =
12-24 22:47:26.842 162 186 I mkfs.f2fs: Info: Segments per section = 1
12-24 22:47:26.842 162 186 I mkfs.f2fs: Info: Sections per zone = 1
12-24 22:47:26.842 162 186 I mkfs.f2fs: Info: Trim is enabled
12-24 22:47:26.843 162 186 I mkfs.f2fs: Error: Failed to open the device!
12-24 22:47:26.859 162 186 I mkfs.f2fs: mkfs.f2fs terminated by exit(255)

and trying to format the partition from the command line fails with the same error:

root@ancora:/ # ls -l /dev/block/vold/private\:179_??
brw------- 1 root root 179, 66 2016-12-24 22:47 /dev/block/vold/private:179_66
root@ancora:/ # mkfs.f2fs /dev/block/vold/private\:179_??

F2FS-tools: mkfs.f2fs Ver: 1.6.1 (2016-03-22) [modified by Motorola to reserve space]

Info: Debug level = 0
Info: Label =
Info: Segments per section = 1
Info: Sections per zone = 1
Info: Trim is enabled
Error: Failed to open the device!

The failed to open device error is very uninformative, but i suppose it boils down to a this kernel option being unset:

root@ancora:/ # zcat /proc/config.gz | grep EFI
# CONFIG_EFI_PARTITION is not set
root@ancora:/ # uname -a
Linux localhost 3.4.110-cyanogenmod-g9817f1e #1 PREEMPT Sat Oct 22 21:17:35 EEST 2016 armv7l

Documentation (I lack permission to post URLs on this forum, remove spaces around dots): lxr . linux . no/#linux+v3.4/block/partitions/Kconfig#L241

config EFI_PARTITION
bool "EFI GUID Partition support"
depends on PARTITION_ADVANCED
select CRC32
help
Say Y here if you would like to use hard disks under Linux which
were partitioned using EFI GPT.

Under CM-13.0-2016-10-22-UNOFFICIAL kernel, the excerpt from /proc/partitions pertaining to the SD card is:

root@ancora:/ # cat /proc/partitions
major minor #blocks name
...
179 64 15558144 mmcblk1
179 65 15558143 mmcblk1p1

For the same SD card inserted in a Linux PC, the kernel says:

marco@p3:$cat /proc/partitions
major minor #blocks name
...
8 16 15558144 sdb
8 17 16384 sdb1
8 18 15540719 sdb2

This test of the same card in another system shows the CM-13.0-2016-10-22-UNOFFICIAL kernel is reading the protective MBR and sees 1 single partition the size of the entire SD less 1 block (the protective MBR), while a kernel supporting GPT sees two partitions, as intended for Android adopted storage.

Background info on GPT and MBR problems here: www . rodsbooks . com/gdisk/wipegpt.html

Is there a public repository with the sources of your appreciated CM-13.0-2016-10-22-UNOFFICIAL image? I see it mentioned in previous posts #5, 7, 9 of this thread, I could not find it with searching. github?

The adoption procedure can be initiated from the command line with:

root@ancora:/ #sm list-disks adoptable
disk:179_64
root@ancora:/ # vdc volume partition disk:179_64 private

Marco Gamberoni