Ext2 on microSD card

Image:Ambox_notice.png
DISCLAIMER: By changing system's internals like described in that article you can easily break you device! Do so at your own risk! Do not type in terminal commands you do not understand! You are fully responsible for your actions.

WARNING! Formatting your MicroSD card to another file system will erase all data on it! Backup the data first!

If you want to format your MicroSD card with ext2 file system to get permissions, symlink/hardlink and big files (bigger than 2 gigabytes) support you have to do the following:

[edit] Format the cart into ext2

Everything have to be performed as root! First make sure that you have e2fsprogs package installed

apt-get install e2fsprogs

Check your MicroSD card's device name (I think it have to be the same on all N900's, but it is worth to recheck which device you are going to format anyway)

mount | grep /media/mmc1

The output have to contain something like that:

/dev/mmcblk1p1 on /media/mmc1

here /dev/mmcblk1p1 is the MicroSD's card device name. Then unmount your MicroSD card:

umount /media/mmc1/

Mark the card partition type as Linux 83

sfdisk -c /dev/mmcblk1 1 83

Format the card:

mkfs.ext2 /dev/mmcblk1p1

Now you can try to mount the card manually

mount -t ext2 /dev/mmcblk1p1 /media/mmc1/

To fix permissions problem you can do the following:

chown -R user:users /media/mmc1/

[edit] Make the card to be automounted by system

As described here [1] and here [2] you have to do the following:

  • Become root
  • Back up the file /usr/sbin/osso-mmc-mount.sh
  • Use vi or your favourite editor to edit /usr/sbin/osso-mmc-mount.sh
  • Make this change (it is line 46 on PR1.1 and PR1.2)

Old:

b | c | e | 4 | 6 | 14 | 16 | 1b | 1c | 1e)

New:

b | c | e | 4 | 6 | 14 | 16 | 1b | 1c | 1e | 83)
  • Save the file
  • Back up the file /usr/sbin/mmc-mount
  • Use vi or your favourite editor to edit /usr/sbin/mmc-mount
  • Make the file to contain the following:
#!/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 -t ext2 -o $3,noauto,noatime,nodiratime "$1" "$2" > /dev/null

NOTE Patola [3] originally suggested to modify the file that way:

#!/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, if mmc-mount is unable to mount it as a vfat card, with all the options, it tries to mount the card with the filesystem type autodetected. But I've mentioned that it does not work if you don't have loaded kernel module of the file system you are going to use. So if you want to use that approach you have to take care that you have ext2's kernel module loaded before the execution of that script.

Save the file and reboot, now the card have to be mounted automatically in all cases.