Version française

Repartitioning the Internal Memory Card of the Nokia N810

Note: this procedure is not official and is not guaranteed. It works with my N810, but I could not test every possible case. In particular, I did not test the USB connection to a PC, I did not test the virtual memory either. In case of freeze, there is still the solution to do a reboot by removing the battery for several seconds.

All the following commands must be executed as root (see the FAQ to get root). You also need to deactivate the virtual memory via the control panel (if you had activated it).

Repartitioning the Memory Card

First let's create the mount point for the second partition:

# mkdir /media/mmc3

Before repartitioning the card, make sure you have backed up all your data, as they will be lost. To be able to repartition, you need to unmount the partition of the card, which is normally mounted on /media/mmc2 automatically:

# umount /media/mmc2

Then let's start the partition table manipulator on the device associated with the memory card:

# sfdisk /dev/mmcblk0

Then you need to enter the first sector of the partition, followed by the size (in cylinders). sfdisk outputs the total number of cylinders: 61440. I divided it by 2 (to obtain two 1-GB partitions): 30720. Thus for the first partition: 0 30720, and for the second: 30720. I don't know why, but the first partition has been remounted. So, let's unmount it again:

# umount /media/mmc2

The partitions have been declared; one now needs to build them:

# mkfs.vfat -F 32 /dev/mmcblk0p1
# mkfs.ext3 /dev/mmcblk0p2

(if you do not have them, these two commands are provided by the dosfstools and e2fsprogs packages respectively, which must be installed first). Before dealing with the automatic mount, you can see what I have obtained on my N810 by typing all these commands.

Automatic Mounting and Unmounting

Now, after a reboot, the first partition will still be mounted automatically, but not the second one. This one can be mounted manually (as root), but one can prefer to mount it automatically.

The standard way to define mount choices under Linux is to modify the file /etc/fstab, but the N810 ignores this file (seemingly because of a kernel bug that would have a memory card not always associated with the same device); moreover the default contents of this file on the N810 are incorrect.

On the N810, the automatic mounting of the internal memory card is done by the script /usr/sbin/osso-mmc-mount.sh (which uses the script /usr/sbin/mmc-mount, that can be modified to enable the executables on the VFAT partition, for instance), and there is also a script to unmount the card: /usr/sbin/osso-mmc-umount.sh. Here are my modifications:

/usr/sbin/osso-mmc-mount.sh

Before the exit $RC (last line), I added:

if [ $PDEV = /dev/mmcblk0p1 ] && [ $MP = /media/mmc2 ]; then
  # Try to mount the second partition too, but do not report any error.
  KERNEL_VERSION=`uname -r`
  if install_module $KERNEL_VERSION mbcache; then
    if install_module $KERNEL_VERSION jbd; then
      if install_module $KERNEL_VERSION ext3; then
        mount -t ext3 -o noatime /dev/mmcblk0p2 /media/mmc3
      fi
    fi
  fi
fi

I have set the noatime option, classic for flash memory. One can also add the data=writeback option. For more information, see the man page of the mount command.

/usr/sbin/osso-mmc-umount.sh

Just before the else, I added:

if [ $MP = /media/mmc2 ]; then
  # Try to unmount the second partition too, but do not report any error.
  umount /media/mmc3 2> /dev/null
fi

But warning! The unmount will fail if the file system is busy (e.g., open file or process that has its working directory there).

Using the ext3 Partition

On the ext3 partition, one obviously has the standard Unix attributes. As for me, I created a directory /media/mmc3/user (as root), then I ran: chown user.users /media/mmc3/user. Thus, I have a second home directory. I also created a directory /media/mmc3/opt where I install software compiled by myself (with make install run as root, of course).



webmaster@vinc17.org