I see some mentions here of creating an ext4-formatted SD card, but no guide. This closely-related question suggests there is no way to do it, but my question differs in that my phone is specifically rooted.
I formatted my card as ext4 (GUID partition-table); my Cyanogenmod phone mounted it at /mnt/fuse/sdcard1
. I followed instructions here to mount the card at /storage/sdcard1
, by creating the following script at /data/local/userinit.sh
#!/system/bin/sh
REALMNT=/mnt/fuse/sdcard1_real
if ! [ -d "$REALMNT" ]; then
mkdir "$REALMNT" || exit 1
fi
mount -t ext4 /dev/block/mmcblk1p1 "$REALMNT"
sdcard "$REALMNT" /storage/sdcard1 1023 1023 &
I restarted and attempting to copy a file (using ES File Explorer) and paste it into its parent directory, which failed:
/storage/sdcard1/foo/bar.mp3: open failed: EACCES (Permission denied).
I can actually play the file fine, so I can open it. FWIW, when I try copying from the original mount point (/mnt/fuse/sdcard1
), I get a slightly different error:
Failed to copy the file bar.mp3
I'm using a Samsung Galaxy S3 with Cyanogenmod 10.2.0-i9300.
==EDIT==
su
ls -l /mnt/fuse
drwxrwxr-x media_rw media_rw 2014-03-04 22:08 sdcard1
That was all. There is no sdcard1_real
in this directory, so I suppose the script is failing?
==EDIT2==
I tried modifying the script to troubleshoot. The script begins fine, but then fails on mkdir "$REALMNT"
with the error /data/local/userinit.sh[6]: : not found
.
==EDIT3==
I know that the script doesn't work, so fixing it might solve my question, but I thought the following was interesting. I formatted my SD card in my Linux computer, and transferred some files to it. Oddly enough, permission errors only occur in the subdirectories that I created. In the root of the partition (via /storage/sdcard1
), I already have write permission.
ls -l /mnt/fuse/
andls -l /mnt/fuse/sdcard1_real
. Then edit your question to include the results. My guess is "wrong file permissions" – either for the mount, or for thefoo/
directory on the card. Remember, ext4 supports full *nix file permissions, incl. user and groups. – Izzy♦ Mar 4 '14 at 13:21su
in terminal to get root. You may need to confirm granting the permission on the phone, if you're doing it for the first time. – Chahk Mar 4 '14 at 13:52echo Script executed > /mnt/fuse/sdcard1/test.log
, and check if it is running at all. If so, make the previous-to-last linemount -t ext4 /dev/block/mmcblk1p1 "$REALMNT" 2> /mnt/fuse/sdcard1/test.log
and check the error message. Or execute the script manually to see:su /data/local/userinit.sh
. – Izzy♦ Mar 4 '14 at 14:00touch
shows that the script is running. I tried executing the script manually withsu /data/local/userinit.sh
, but this failed. I also triedsu echo foo
, and get a similar error:Unknown id: echo
. – Sparhawk Mar 5 '14 at 1:46echo
to output each command before it's executed, and redirect error output with2>>
. – Izzy♦ Mar 5 '14 at 10:15