Creating a large partition and booting off it

I found it is possible to add a partition to the internal flash card.

Contents

WARNING: Using this recipe you will loose MyDocs.

Make a backup of MyDocs!

Creation of the new partition

umount /home/user/MyDocs

/home cannot be umounted, unfortunately. But this didn't do any harm to /home

Use parted to shrink the MyDocs partition (on my N900 it was the 1st one)

parted /dev/mmcblk0 print
parted /dev/mmcblk0 1 resize 1kb 25GB

reboot

Use fdisk to

  1. remove the first partition (Because parted makes it not end on a cylinder boundary)
  2. recreate the exactly same partition again (this time ending on a cylinder boundary) Make sure to specify "TYPE C" for vfat
  3. add the 4th partition right after the 1st one

reboot

Enjoy the new partition.
The result might look similar to this one
Disk /dev/mmcblk0: 32.0 GB, 32015122432 bytes
4 heads, 16 sectors/track, 977024 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk identifier: 0x000c260e

       Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1               1      762940    24414072    c  W95 F AT32 (LBA)
/dev/mmcblk0p2          884866      950401     2097152   83  Linux 
/dev/mmcblk0p3          950402      974977      786432   82  Linux swap /  Solaris
/dev/mmcblk0p4          762941      884865     3901600   83  Linux

Using the new partition

Using bootmenu.sh you can in fact boot from that partition. (I got bootmenu.sh via svn from https://garage.maemo.org/plugins/scmsvn/viewcvs.php?view=rev&root=bootmenu&revision=53 using trunk/install_bootmenu)

Copy the stuff of your root dist to the new one

rsync -rlutopgxv / <mountpoint of new partition>

Copy the device tree (Sure this is too much, but not copying it will not work)

cp -af /dev/* <mountpoint>/dev

Using bootmenu.sh and this entry in /etc/bootmenu.d I can now boot into my new 3.7GB root drive

ITEM_NAME="Internal part 4"
ITEM_ID="mmc4"
ITEM_DEVICE="mmcblk0p4"
ITEM_MODULES="mbcache jbd ext2"
ITEM_FSTYPE="ext2"
ITEM_FSOPTIONS="noatime"
ITEM_LINUXRC=""
ITEM_FBMODE=""

Result

[root@phon:~/bootmenu]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                3,7G  524M  3,0G  15% /
ubi0:rootfs           228M  192M   33M  86% /mnt/initfs
/dev/mmcblk0p4        3,7G  524M  3,0G  15% /
tmpfs                 1,0M   60K  964K   6% /tmp
tmpfs                 256K   84K  172K  33% /var/run
none                   10M   76K   10M   1% /dev
tmpfs                  64M  4,0K   64M   1% /dev/shm
/dev/mmcblk0p2        2,0G  129M  1,8G   7% /home
/dev/mmcblk0p1         24G  7,9G   16G  34% /home/user/MyDocs