4

I'd like to install a bootable Linux system on a micro SD card, AND be able to use it as external storage for other devices, such as my Android phone.

The plan: Linux ARM on a Raspberry Pi 4.

If I insert an SD card (with Arch Linux ARM installed) into my phone, Android only detects the first partition of the SD card (the boot partition). The desired outcome is to mount my home partition with my music, and not the boot partition.

I have thought of 2 possible solutions:

  1. Find an Android file manager app that can access the 3rd partition (home)
  2. Make the first partition my home partition, and then the boot partition as the second, root as 3rd.

No luck with the first solution, and I really don't know how to approach the 2nd solution with a successful boot, and I can't install the system via USB, as Raspberry Pi doesn't support it.

Working solution, adding to Philip Couling's insight

I could not get Android to read a 2nd partition, no matter the filesystem (at least unrooted), so I deduced that the only choice I had based on my tests were to expand my boot partition, my first partition.

Android was able to read vFAT, but was not able to boot Linux (Raspberry Pi 4), but your mileage may vary. It was able to boot from FAT32.

I think the best possible file system available to be both read by Android, and to be bootable with a Raspberry Pi 4 is FAT32. Unfortunate, but it will get the job done.

My OSes of choice were either Manjaro or Arch, but their default installations make the boot partition FAT16. I was able to change it to FAT32 with the help of GParted, and remained bootable. It was crucial to make sure making sure the labels were identical for Manjaro to be able to boot (BOOT_MNJRO and ROOT_MNJRO) as it was instructed in "/boot/cmdline.txt"

The MicroSD card can now be used as a bootable system, AND used for extra storage for my Android phone. The goal was to use a 2nd MicroSD card as a backup drive, and still be able to use it as portable storage on my phone!

Appreciate Philip Couling's great insight, and using syslinks has made my home directory feel natural.

7

1 Answer 1

2

My first thought is that you need to find a filesystem that supports linux AND is accepted by Android. I suspect Android is quietly refusing to mount an ext4 partition.

My thought here is that Android's is deliberately refusing because ext2,3,4 partitions pose a security risk if not dealt with correctly. Unfortunately the features that pose a security risk (device files and unix style user permissions) are necessary to run linux ... i believe. So in short, I think you will have a big problem getting this to work.

What might work

What you are asking for is not unreasonable. You want to access your /home directory from android. Linux might need ext2,3,4 features for the OS but it generally doesn't need them for a user's home. It certainly doesn't need them for your /home/<username>/Music or /home/<username>/Pictures directory.

Rather than trying change your whole OS, you could easily create a FAT32 partition to put your media files on. If Android really doesn't like accessing a second partition, you could even expand /boot to give it enough space.

Once you have a partition that both can see, and is large enough for your media you can mount it to /media/home and move things around:

mkdir /media/home mount /dev/sda3 /media/home mv ~/Pictures /media/home ln -s /media/home/Pictures ~ mv ~/Music /media/home ln -s /media/home/Music ~ 

Don't forget to modify /etc/fstab to mount the partition automatically.

3
  • I just realised that the Pi`s boot partition is some sort of FAT. root partition is ext4. So as a hack you could combine the boot and android data into one partition. Commented Jan 4, 2021 at 12:30
  • @ctrl-alt-delor yes that's what I meant by expanding /boot Commented Jan 4, 2021 at 12:34
  • 1
    Sorry for the delayed response, took some time building my new system ;) Updated my post on what exactly I did. Thanks for the reminder of syslinks, they have been useful for my common home directory folders, makes it feel more natural. Commented Jan 26, 2021 at 23:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.