Free and Open Source Software
The location to find out about free and open source software. Reviews, commentary, tips and tricks. All welcome.
Extended root partition on an N800 with OS2008
Like many, I wanted to increase the space available to me for my root partition on my n800. There are a lot of sites describing the process of putting the whole of root onto your memory card but I wanted to keep using the internal flash for most of the OS and move only data and some self compiled apps/scripts to the mmc.
The following procedure assumes you have at least a working knowledge of the Linux CLI and have root access to your n800 (note - the procedure should also work for an n810).
Warning: You will be formatting your memory card and modifying boot and system scripts, so, before you do anything backup your data!! You have been warned!
Disclaimer: Follow this procedure at your own risk. If you lose any data or brick your device I take no responsibility (don’t worry though, you can just re-flash it to get back to a pristine state).
Step 1 - Partition and Format the Card
I will describe creating 2 partitions on your card. One will be formatted as ext3 and used as the extension to the root partition and the other will be formatted as FAT and be seen as a normal memory card by the OS, just as it was previously. When planning how to partition your card you should plan to use the first partition for your FAT partition and the second as the extension to root. As such you probably want to have the first partition bigger than the second, for example on my 4Gb card I created a 3Gb FAT and a 1Gb Ext3 partition.
OS2008 doesn’t include mkfs.ext3 (or mkfs.ext2), needed to format your partitions. So, if you want to use ext2 or ext3, the first thing you’ll need to do is install them. They are both included in the e2fsprogs package:
apt-get install e2fsprogs
Before you can partition your memory card you must first umount it:
umount /media/mmc2
In order to partition the card you need to use sfdisk as OS2008 doesn’t include cfdisk. Running:
sfdisk /dev/mmcblk0
will give you an sfdisk prompt as follows:
/dev/mmcblk0p1 :
At the prompt, you need to enter the starting block and size, in cylinders, of the first partition, eg for a 3Gb partition:
/dev/mmcblk0p1 : 0 9660
Hitting Enter will prompt you for the second partition and then the third etc. Just leave them blank if you only need 2 partitions:
/dev/mmcblk0p2 : 9660 3220
/dev/mmcblk0p3 :
/dev/mmcblk0p4 :
Finally you will be asked if you want to write the changes. Hit “y” if you are happy with the partitioning scheme you entered, alternatively you can hit “n” to try again.
Once your new partitions have been written out to the card, you need to format them (you may need a reboot here before you can format the new partitions).
mkfs.mdos /dev/mmcblk0p1
mkfs.ext3 /dev/mmcblk0p2
Step 2 - Enable the extended partition at boot
You’ll now need to edit an init script to load the modules needed to see your ext3 partition and also mount it early in the boot process. Open up /etc/init.d/rcS and after the PATH= line add the following:
insmod /mnt/initfs/lib/modules/2.6.21-omap1/mbcache.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/jbd.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext3.ko
Now, near the end of the file, before the line exit 0, add:
mount -a -t ext3
Save and exit the file.
Next you need to create a mount point for your partition, I chose to use /extfs:
mkdir /extfs
Now add the partition to /etc/fstab:
/dev/mmcblk0p2 /extfs ext3 defaults,rw,noatime 0 0
Now reboot and once your device comes back up you should have a spanking new 1Gb partition under /extfs and a 3Gb memory card (or whatever you configured).
Step 3 - Making sure you can still see your card when connected to your PC via USB
If you now connect your device to a PC via USB, you’ll get a message stating “Memory cards in use: internal memory card” and your memory card won’t be available to your PC. To get round this you need to edit /usr/sbin/oss-mmc-umount.sh, replace the if block after the line grep "$MP " /proc/mounts > /dev/null with:
if [ $? = 0 ]; then
if [ "$MP" != "/extfs" ] ; then umount $MP 2> /dev/null ; fi
RC=$?
if [ $RC != 0 ]; then
echo "$0: could not unmount $MP"
exit $RC
fi
fi
Note - if you called your mount point something other than extfs, remember to edit the test [ "$MP" != "/extfs" ] accordingly. Your FAT partition will now be umount’ed before being made available to your PC. The linux partition also be available but will remain mounted in your device. This should be safe as long as you don’t try to write to the ext3 partition, you probably only need to write to the FAT partition anyway.
Step 4 - Transferring data from Flash to the partition
This is the easy bit. You can transfer any data you want from the flash memory to your new partition. If you then create a symlink to the new location it will be accessible just as it was previously. Good candidates for moving are /usr/share and /home. eg:
cp -a /usr/share /extfs
rm -r /usr/share
ln -s /extfs/share /usr/share
References:
http://www.internettablettalk.com/forums/showthread.php?p=40839#post40839
|
Why every guy should buy their girlfriend Wii Fit.
Gratuitous...
|
|
Astronomy Picture Of The Day
This picture makes us feel very very small.
|
|
Hottest Girl Superhero List
A list of female video-game characters you should check out.
|










