I want to split my SD cart in 2 partitions: one for android, and one containing a bootable OS used from computers through USB or by inserting in card readers. I can't access the second partition from USB!


  • Phone: motorola defy+
  • System: CynogenMod 10 (android 4.1.2)
  • SD Card layout:
    1. Primary FAT32, 1Gb, intended for android only (apps data)
    2. Primary EXT4, 15Gb, invisible from android intended for computers (bootable linux system)

Current status:

  • Everything works with a laptop SD card reader: I can mount and browse both FAT32 and EXT4 partiations. I can boot from the SD card and boot to the linux I installed on the ext partition.
  • From the phone: android can mount and access the FAT32 partition, the ext4 partition is invisible just like I want.
  • Problem from USB: When accessing the card in the phone from a computer through USB (android is configured as USB mass storage device), I can only access the FAT32 partition.

My question:

Android seems to be exposing only the first partition as a block device through USB. Therefore I can't access the second partition, or even see it with partitioning tools. Obviously, booting from it also doesn't work. Can I make Android to expose the full SD card as a block device through USB, so that all partitions are visible from a computer and I can boot on it.

Any help or pointers appreciated, thanks!

  • 3
    Your guess is correct: only the first partition is exposed via UMS. This fact is used e.g. by some advanced App2SD+ stuff (and e.g. Link2SD) so "moved apps" and their widgets are not broken when USB is connected. I'm afraid the answer to your question will be a simple "No".
    – Izzy
    Feb 20, 2013 at 15:57

2 Answers 2


You can try to use the MBRFAT hack — the first sector which looks both like a FAT boot sector and a MBR partition table. Such images can be created by the makebootfat utility.

I did not try to do this actually, but in theory you should do the following:

  1. Create a files directory which should contain files to be placed into the FAT32 filesystem image (it could just be empty).

  2. Locate the following files:

    • mbrfat.bin — should be contained in the makebootfat package;
    • ldlinux.sys and ldlinux.bss — come from the Syslinux 3.x package (use a 3.x version, I'm not sure that makebootfat is compatible with more recent versions).
  3. Create a file for the FAT32 filesystem image with the desired size of the FAT32 part:

    dd if=/dev/zero of=fat.img bs=1M count=1024
  4. Create the FAT32 filesystem image with MBRFAT:

    makebootfat -o fat.img -m mbrfat.bin -b ldlinux.bss  -c ldlinux.sys -F -Y -v files/

    (Note that placing ldlinux.sys in the files/ directory does not work — it must be copied with the -c option.)

  5. Put your card in the phone and attach it to your computes as UMS (it you work with a card reader, it would be hard for you to mount nested partitions).

  6. Write the created image to the whole disk device exposed by your phone:

    dd if=fat.img of=/dev/sdX bs=1M
  7. Create your additional partitions on the same device that you have written the image to. If you want to place the bootloader on the EXT4 partition instead of using SYSLINUX on the FAT32 partition, mark your EXT4 partition active and remove the active flag from the FAT32 partition.

  8. Make a backup copy of the MBR+FAT sector:

    dd if=/dev/sdX of=mbr_fat_backup.bin bs=512 count=1
  9. Install Linux on the EXT4 partition, being very careful to avoid installing the bootloader to the MBR of the disk. Some installers do not support installing the bootloader into the partition boot sectors; in this case either skip the bootloader installation and install it manually later, or (if skipping is also not possible) restore the MBR+FAT sector from the backup after installation, then install the bootloader into the partition boot sector. Or you may configure SYSLINUX on the FAT32 partition as your bootloader (for this you will need to copy the kernel and initramfs image to the FAT32 partition).

This configuration would work as follows:

  • Android will see the outer partition contents just as a FAT32 partition, although with the number of sectors in the filesystem smaller than the partition size. The Linux kernel on the Android device will not try to parse the nested partition table, therefore the nested EXT4 partition will not be accessible from there.
  • When Android exposes the partition contents as an USB mass storage device, the OS on the host computer will parse the sector 0 of the exposed device as an MBR partition table, and will see multiple partitions there. For the FAT32 partition it will use another sector as the boot sector containing the FAT32 BPB; this copy of BPB will contain a smaller value in the “number of reserved sectors” field, so that the FAT and data clusters will end up in the same physical sectors as when using the BPB in sector 0 of the outer partition.

The problem with this config is that accessing the EXT4 partition when using the card in a card reader will not be possible, unless you use utilities like kpartx to expose nested partitions. Booting when using a card reader could work if you create another partition on the card directly and install some bootloader there (with a separate copy of kernel and initramfs images); note that this partition will not be accessible when using the phone.

In addition, mbrfat.bin is somewhat buggy, and some computers fail to boot when using it.


You may only be able to do it via it's Recovery by using the Mount USB Storage function. It is present in all custom recoveries. The plausible reason that you cannot access the EXT4 partition in android is because it might be mounted and used by Cyanogenmod. You might be able to forcefully unmount the EXT4 in the Recovery on the Mount menu and unchecking the corresponding mount, if the kernel supports it.

  • It's no mounted, I think @Izzy is right. I can't even access the partition table through USB. Only the first partition is exposed.
    – Antoine
    Feb 21, 2013 at 14:16

You must log in to answer this question.

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