We have moved to a new Sailfish OS Forum. Please start new discussions there.
36

Bug: SD card formatted to ext4/btrfs is not mounted automatically [released]

asked 2013-12-25 13:53:25 +0300

Venemo gravatar image

updated 2014-06-12 16:56:05 +0300

chemist gravatar image

An SD card that has a single partition formatted to ext4 or btrfs is not mounted automatically.

The question has been closed for the following reason "released in a software update" by chemist
close date 2014-06-12 16:55:41.680680

Comments

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 )
add a comment

5 Answers

Sort by » oldest newest most voted
9

answered 2013-12-25 14:35:30 +0300

hlub gravatar image

updated 2013-12-28 11:22:31 +0300

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.

link

Comments

Could you open a pull request at the URL @Kontio listed, with you fix? Please.

Venemo ( 2013-12-25 14:45:56 +0300 )

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: I would like to submit a patch, but I feel that my solution is a rather ugly hack. I'll have a better look when I have time

hlub ( 2013-12-25 14:58:12 +0300 )

@hlub I suggest you submit it even if it's a "hack" - working software is always better than non-working software, even if it works by just a "hack" :P

Venemo ( 2013-12-25 16:08:32 +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 )
see more comments
7

answered 2014-06-12 14:11:18 +0300

Venemo gravatar image

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. :)

link
add a comment
5

answered 2013-12-25 14:38:43 +0300

Kontio gravatar image

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

link

Comments

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:

https://together.jolla.com/question/1112/bug-sd-card-formatted-to-ext4btrfs-is-not-mounted-automatically/

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 )
add a comment
1

answered 2014-01-31 00:23:37 +0300

Zombie gravatar image

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.

link

Comments

Nice solution.

masmrlar ( 2014-01-31 10:00:11 +0300 )
add a comment
1

answered 2014-02-13 18:20:46 +0300

STiAT gravatar image

The proper patch for this can be found here: https://github.com/nemomobile/sd-utils/commit/aac9482cf27ac5d85a854e88c906d6f0040479e3

link
add a comment

Question tools

Follow
15 followers

Stats

Asked: 2013-12-25 13:53:25 +0300

Seen: 4,447 times

Last updated: Jun 12 '14