Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Moebian
Summary Tracker Lists Tasks Docs News SCM Files Wiki

Repartition Instructions

please have a look at the more general and update page http://wiki.maemo.org/Repartitioning_the_flash

Repartitioning N900 internal memory card

By default, N900 has a 28G vfat partition, mounted as /home/user/MyDocs.

Here is an instruction how to shrink it to 20G, and use freed space for adding extra partitions. No changes other than shrinking original partition are done to original system, so it should not break anyhow, should survive further over-the-air upgrades, and be otherwise full-functional. New partitions added won't be anyhow used by original system.

Backup everything!

Really. Although procedure is believed to be safe, everything may happen. So be prepared for reflashing. Use N900's backup utility and don't forget to copy backup from /home/user/MyDocs/backups somewhere out of the device. Also, if you have made by-hand changes to N900's filesystem, don't forget to backup those. It is a good idea to backup entire /etc.

Also note that MyDocs partition will be removed in the process. So all it's content will be lost. So copy it to your computer. Fast way to do that is over USB - copy entire partition, don't forget about dot files. If you run Linux on your PC, you may mount N900's partition over USB, and use there commands (assuming you mounted N900 to /mnt):

 mkdir ~/n900-backup
 (cd /mnt && tar cpf - .) | (cd ~/n900-backup && tar xpf -)

Obtain fdisk utility

N900 filesystem contains sfdisk utility, but it is a bit inconvenient in my taste. I suggest to use good old fdisk instead, that may be taken from Debian Lenny util-linux armel binary package. Here is how to extract it directly on network-connected N900.

 mkdir -p /home/user/util-linux /home/user/bin
 cd /home/user/util-linux
 wget http://ftp.de.debian.org/debian/pool/main/u/util-linux/util-linux_2.13.1.1-1_armel.deb
 dpkg-deb -x util-linux_2.13.1.1-1_armel.deb root
 cp root/sbin/fdisk /home/user/bin/
 cd ..
 rm -rf util-linux

This will result in /home/user/bin/fdisk binary available no N900.

Alter /dev/mmcblk0 partition table

Now unmount /home/user/MyDocs and run (as root)

  /home/user/bin/fdisk /dev/mmcblk0

Type p command. Here is how original partition table looks:

         Device Boot      Start         End      Blocks   Id  System
 /dev/mmcblk0p1               2      884865    28315648    c  W95 FAT32 (LBA)
 /dev/mmcblk0p2          884866      950401     2097152   83  Linux
 /dev/mmcblk0p3          950402      974977      786432   82  Linux swap / Solaris

This is what I done next:

  • used d command to delete partition 1;
  • used n command to recreate primary partition 1, in 2 - 622721 block range;
  • used n command to create extended partition 4, in 622722 - 884865 block range;
  • used n command to create a 5G logical partition /dev/mmcblk0p5;
  • used n command to create a 3G logical partition /dev/mmcblk0p6;
  • used t command to set type of partitions 1, 5 and 6 to 76 (Unknown).

Setting partition type to Unknown will prevent N900 original system from trying to use these partitions on reboot. This is needed for /dev/mmcblk0p1 as well, since it won't have a filesystem on it on first reboot.

Here is the result shown by p command:

         Device Boot      Start         End      Blocks   Id  System
 /dev/mmcblk0p1               2      622721    19927040   76  Unknown
 /dev/mmcblk0p2          884866      950401     2097152   83  Linux
 /dev/mmcblk0p3          950402      974977      786432   82  Linux swap / Solaris
 /dev/mmcblk0p4          622722      884865     8388608    5  Extended
 /dev/mmcblk0p5          622722      775310     4882840   76  Unknown
 /dev/mmcblk0p6          775311      884865     3505752   76  Unknown

Now process is just before the point of no-return. Are your backups ok? If unsure, you may still quit fdisk without saving and keep your original system.

To continue, type w command. This will write updated partition table to device.

Kernel won't be able to read updated partition table before reboot, because /dev/mmcblk0p2 and /dev/mmcblk0p3 are in use. Because of that, you must not try to use new partitions before reboot.

Reboot

Next step is to reboot. System should boot as usual, just it won't mount /home/user/MyDocs. Depending on installed software, something may not start - but at least base system should start.

After reboot, kernel should use updated partition table, so now new partitions can be used.

Restore MyDocs partition

When booting without MyDocs partition available. N900's system could create something under /home/user/MyDocs directory. Remove all that - it just wastes space in /dev/mmcblk0p2.

Run fdisk and change partition 1 type back to 0c. Then save the result. Since partition geometry was not change, reboot is not necessary after this.

Next, run

 mkfs.vfat -F 32 /dev/mmcblk0p1

Now MyDocs partition is back, just a bit smaller.

After this step I decided to reboot once more, to get MyDocs added to /etc/fstab (that is regenerated at each reboot) with original mount options.

Then restore MyDocs content (over USB or using whatever other method). With Linux on PC, I mounted N900's partition to /mnt and used

 (cd ~/n900-backup && tar cpf - .) | (cd /mnt && tar xf -)

This may result in lots of error messages about chmod operation not permitted - which is exactly the case for vfat filesystem, and thus may be safely ignored.

Note that now MyDocs partition is smaller, so if previously it was filled, now it may run out of space, and you may have to remove something from there.

Then I rebooted once more - just to ensure that renewed device works as before.

That's all

Just after reboot, you may find your media collection empty. Things will be back as soon as indexer completes it's job. Unfortunately, media player statistics gets lost - don't know how to restore it, sorry.

Now N900 should work as before, but there are two extra partitions to play with. Enjoy!


(last edited March 21, 2010) - Read Only [info] [diff])
FindPage by browsing or searching
5 best incoming links: FrontPage (6), RecentChanges (2)
5 best outgoing links:
5 most popular nearby: FrontPage (762), RecentChanges (207)

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment