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.
We have moved to a new Sailfish OS Forum. Please start new discussions there.
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.
@Venemo: there is already a pending pull request targeting precisely this problem. Expect a solution soon!
hlub ( 2013-12-25 23:56:19 +0200 )editThe /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 +0200
)editMy 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
This thread is public, all members of Together.Jolla.Com can read this page.
Asked: 2013-12-25 13:53:25 +0200
Seen: 4,417 times
Last updated: Jun 12 '14
My Jolla does not recognise any micro sd card. What I can do? [answered]
[Fixed in 1.0.3.8] Crash when linking contacts? [not relevant]
Bug: Virtual keyboard stuck on top of applications
Push up menu and vkb small visual issue [released]
MicroSD as removable drive in Windows [released]
Bug: when replying to a message from a contact, can't edit To field [released]
AGPS lets Mobile Data become active even when connected to wifi [released]
(bug)better sdcard support for music (and all other)
Camera should have an option to select where to save photos [released]
Time slider usage in video player of Gallery app causes the app to hang [duplicate]
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 +0200 )editfor 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 +0200 )edit