maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   automount ext3 microSD (https://talk.maemo.org/showthread.php?t=42045)

j.s 2010-01-25 17:39

Re: automount ext3 microSD
 
Quote:

Originally Posted by greenfly (Post 493909)
Did you change the partition type of the microSD to be type 83 (used for Linux partitions) or did you leave it as a FAT partition type and just change the format of the file system on that microSD partition?

Who are you asking? It happens that I repartitioned my microSD in the n900 and documented it in post http://talk.maemo.org/showthread.php...224#post425224

Relevant section:
Code:

sfdisk --change-id /dev/mmcblk1 1 83
mke2fs -t ext2 -m 0 /dev/mmcblk1p1

I have to manually mount this card after every boot.

Andrwe 2010-01-26 08:28

Re: automount ext3 microSD
 
Quote:

Originally Posted by greenfly (Post 493909)
Did you change the partition type of the microSD to be type 83 (used for Linux partitions) or did you leave it as a FAT partition type and just change the format of the file system on that microSD partition?

I hadn't done it but now I have and it doesn't work either.

Lord Raiden 2010-01-26 14:55

Re: automount ext3 microSD
 
ROFL! What are you guys doing wrong? I'm using ext3 on at least one of my cards, and it auto mounts without even batting an eye! :D

offthefront 2010-01-26 16:28

Re: automount ext3 microSD
 
Well my ext3 didn't automount either :-)
This is how I make it.
Usual disclaimers, if this doesn't make sense to you, you probably shouldn't be trying it ...

add these 4 lines to the bottom of /usr/sbin/mmc-mount
if [ $? -ne 0 ]
then
mount -o $3,noatime,nodiratime "$1" "$2" > /dev/null
fi

GI jack 2010-02-01 23:10

Re: automount ext3 microSD
 
Quote:

Originally Posted by offthefront (Post 495736)
Well my ext3 didn't automount either :-)
This is how I make it.
Usual disclaimers, if this doesn't make sense to you, you probably shouldn't be trying it ...

add these 4 lines to the bottom of /usr/sbin/mmc-mount
if [ $? -ne 0 ]
then
mount -o $3,noatime,nodiratime "$1" "$2" > /dev/null
fi

I just done this. I also edited out the code in rcS-whatever to keep from re-writing my /etc/fstab everyboot.

So far.

1. I can use "mount" to mount my sd card.
2. /etc/fstab doesn't wipe on boot.

I need to automount it on boot, lets say to /test. What am I missing??

stair 2010-02-04 16:29

Re: automount ext3 microSD
 
I've managed to make the automount work for ext2 or ext3 on my N900 (PR1.1)

As usual any changes are at your own risk.....

The script /usr/sbin/osso-mmc-mount.sh is the one which seems to be responsible for doing the mounting for all partitions on MMC devices. It does some checks and then calls /usr/sbin/mmc-mount for each partition.

Looking at /usr/sbin/osso-mmc-mount.sh I found this section of code:

case "$PID" in
b | c | e | 4 | 6 | 14 | 16 | 1b | 1c | 1e)
logger "$0: $PDEV partition type is '$PID'"
;;
*)
logger "$0: $PDEV type '$PID' is not FAT32 or FAT16"
exit 1
;;
esac


What this is doing is looking at the Partition ID number (in hex) and checking it against a list of allowed values. If it is not an allowed value it falls through to the second case block and exit is called - meaning that the partition is not mounted.

The hex Partition ID for ext2 and ext3 is 83 - as you can see it is not on the list, and so this script will never attempt to mount ext2 or ext3 partitions. To fix this we simply need to add 83 to the list of allowed partition IDs in the case.

As normal - be very careful making changes as root. Having said that, here's how to change it:
1) Become root
2) Back up the file /usr/sbin/osso-mmc-mount.sh
3) Use vi or your favourite editor to edit /usr/sbin/osso-mmc-mount.sh
4) Make this change (it is line 46 for me on PR1.1)
Old:
b | c | e | 4 | 6 | 14 | 16 | 1b | 1c | 1e)
New:
b | c | e | 4 | 6 | 14 | 16 | 1b | 1c | 1e | 83)
5) Save the file
6) Reboot


You should now find that ext2 or ext3 partitions automount correctly.

Patola 2010-03-20 13:13

Re: automount ext3 microSD
 
Thanks for your recipe, stair. But I found that it didn't work quite correctly on mine. I did the following extra step:

I modified /usr/sbin/mmc-mount which is in fact a shell script. It contains:

Code:

#!/bin/sh
mount -t vfat -o $3,noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir "$1" "$2" > /dev/null

That is, it tries to forcibly mount the mmc as a vfat filesystem. As this script is run everytime the back cover is attached to the phone (and its counterpart /usr/bin/mmc-unmount is run every time the back cover is opened -- yes, the path is different and it's a binary file!), I find it safer to modify it this way:

Code:

#!/bin/sh
mount -t vfat -o $3,noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir "$1" "$2" > /dev/null || mount -o $3,noauto,noatime,nodiratime "$1" "$2" > /dev/null

This way, mmc-mount first tries to mount it as a vfat card, with all the options. If it is unable to do it, it tries to mount the card with the filesystem type autodetected. It works best because this setup allows you to insert other types of MMC (vfat, ext2, ext3, whatever the N900 kernel supports) and also works correctly with the internal MMC card, which is vfat. I verified by plugging it with the USB cable and also removing the back cover and putting it back. It worked right in all these occasions and also unmounted and mounted the internal MMC correctly.

angrycore 2010-10-12 11:17

Re: automount ext3 microSD
 
I've made a wiki page containing the information found in that thread, you can check it here: http://wiki.maemo.org/Ext2_on_microSD_card

int_ua 2010-12-15 23:44

Re: automount ext3 microSD
 
just wrote this script while travelling by the subway:
Code:

#!/bin/sh
# mmc-mounter 0.1
# Licence: GPLv3
# The script was written for Maemo 5 on Nokia N900
# to ease mounting multiple microSD partitions
# since the system wasn't able to recognise them.
# I hope it can help on other devices or OSes too.
# (c) 2010 Serhiy Zagoriya (int_ua)
# *please* mail bugs and feature requests to xintx.ua@gmail.com

if [ "$1" == "mount" ]; then
for partition in `ls /dev/mmcblk1p* | grep -o "[0-9]$"`; do
 echo "Partition "$partition
 mkdir -p /home/user/mmc/$partition
 sudo mount /dev/mmcblk1p$partition /home/user/mmc/$partition
 mountresponse=$?
 if [[ $mountresponse != 0 ]]; then
  if [[ $mountresponse == 255 ]]; then
  echo "Already mounted"
  continue
  fi
  echo "Failed to mount /dev/mmcblk1p$partition automatically."
  read -p "If you know it's filesystem type, type it, ortherwise just press Enter: " fstype
  if [ "$fstype" != "" ]; then
  echo "mounting /dev/mmcblk1p$partition with '-t $fstype' option"
  sudo mount -t $fstype /dev/mmcblk1p$partition /home/user/mmc/$partition
  fi
 fi
done
#read -p "press Enter to close" None
exit 0
fi

if [ "$1" == "unmount" ]; then
for mountpoint in `cat /etc/mtab | grep -o "/dev/mmcblk1p[0-9]*"`; do
 echo "Unmounting $mountpoint"
 sudo umount $mountpoint -f
 if [[ $? != 0 ]]; then
  lsof | grep /home/user/mmc/`echo $mountpoint | grep -o "[0-9]*"`
  echo -e "---\nCannot unmount partition $mountpoint. If it was mounted using mmc-mount script and there was opened files on it they are listed above (with lsof command)."
 fi
done
#read -p "press Enter to close" None
exit 0
fi

echo "usage: mmc-mounter.sh {mount|unmount}"
exit 1

Tomorrow I will try to enhance it with all your advices, especially Patola's one :)
I hope it will become alternative for those who don't want to mess with system files :)

saponga 2012-05-09 17:41

Re: automount ext3 microSD
 
Quote:

Originally Posted by angrycore (Post 839180)
I've made a wiki page containing the information found in that thread, you can check it here: http://wiki.maemo.org/Ext2_on_microSD_card

Does anybody knows if it works on PR 1.3 and/or ext3 ? If yes (and if i do everything right) does the system could be restored from SD card using backupMenu ?
I'm asking just because i culdn't backing up rootfs and optfs to SD (ext3) since it wasn't automounted.
Hope someone understand what i mean...
Thanks.


All times are GMT. The time now is 05:44.

vBulletin® Version 3.8.8