Bug: SD card formatted to ext4/btrfs is not mounted automatically [released]
An SD card that has a single partition formatted to ext4 or btrfs is not mounted automatically.
An SD card that has a single partition formatted to ext4 or btrfs is not mounted automatically.
At boot time the SD card is mounted by (systemd
calling) the shell script /usr/sbin/mount-sd.sh
.When you have a look at it, you see that it specifies uid
and gid
:
mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID
This makes a lot of sense when mounting a FAT filesystem, but not so much when mounting say btrfs, so the mount command will fail in that case, leaving you with an unmounted SD card. I solved the problem by editing the script, adding a fallback mount command:
mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID || mount -o relatime $SDCARD $MY_MOUNTPOINT
(edit: replace $MY_MOUNTPOINT
above by $MNT
if you want the SD-card mounted the very same way a FAT-formatted card would - I am using a different mount point)
This works, but whether it is a good idea remains to be seen: trackerd
scans the sdcard so putting lots of Linux stuff like say a Gentoo prefix installation on it is not a good idea. I will probably re-partition, putting a vfat system on the first partition and a big btrfs on the second.
Note: I don't want to put any Linux stuff on the SD card, but ext4/btrfs is the only way currently to use a 64GB SD card with the Jolla.
Venemo ( 2013-12-25 14:46:36 +0300 )@Venemo: there is already a pending pull request targeting precisely this problem. Expect a solution soon!
hlub ( 2013-12-25 23:56:19 +0300 )It seems that this has been solved during the last few updates. Jolla recognizes my 64GB ext4-formatted SD card immediately and tracker can even index the songs on it. Thanks for the Jolla people for implementing it!
I think we can close this feature request. :)
The /usr/bin/mount-sd.sh script is not smart enough yet (triggered by /etc/udev/rules.d/90-mount-sd.rules), it gives mount options which Ext4 module does not understand (I didn't test btrfs, but I assume it's the same problem), so currently just vFat as a file system is supported:
[ 190.490737] EXT4-fs (mmcblk1p1): Unrecognized mount option "uid=100000" or missing value
The script is developed here, you can help to improve it: https://github.com/nemomobile/sd-utils
The script could also take multiple partitions into account, so no reformatting would be needed e.g. for existing N900 sdcards with swap:
Device Boot Start End Blocks Id System
/dev/mmcblk1p1 2048 4196351 2097152 82 Linux swap / Solaris
/dev/mmcblk1p2 4196352 31326207 13564928 b W95 FAT32
twi42 (
2013-12-30 18:56:06 +0300
)Here is one working version of /usr/sbin/mount-sd.sh script:
I have Sandisk Ultra microSDXC UHS-I (64 GB) card with btrfs filesystem and it is automatically mounted with the above change.
dtw ( 2013-12-30 21:02:32 +0300 )My solution (prior to stumbling on this report) was the following:
diff --git a/scripts/mount-sd.sh b/scripts/mount-sd.sh
index 3e42403..5bab959 100755
--- a/scripts/mount-sd.sh
+++ b/scripts/mount-sd.sh
@@ -15,7 +15,11 @@ if [ "$ACTION" = "add" ]; then
exit $?
fi
su $DEVICEUSER -c "mkdir -p $MNT"
- mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID
+ if /usr/bin/file -Ls $SDCARD | grep ext[234]; then
+ mount $SDCARD $MNT
+ else
+ mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID
+ fi
else
umount $SDCARD
This works fine for ext4. I guess it can be easily extended to support btrfs.
The proper patch for this can be found here: https://github.com/nemomobile/sd-utils/commit/aac9482cf27ac5d85a854e88c906d6f0040479e3
Asked: 2013-12-25 13:53:25 +0300
Seen: 4,446 times
Last updated: Jun 12 '14
What's the status on this? I tried to use a btrfs-formatted sd-card but it's not mounting. I compared the mount-sd.sh from github mentioned here with the one installed on my phone and they differ greatly: the one on the phone is about double the size. So I'm wondering: which one is the most current one?
stephan ( 2014-05-28 19:14:10 +0300 )for me it worked out of the box with the current release, btrfs made on mmcblk01 not on mmcblk01pX !
chemist ( 2014-05-31 19:50:46 +0300 )