<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>maemo.org wiki - User contributions [en]</title>
		<link>http://bugs.maemo.com/Special:Contributions/87.205.192.7</link>
		<description>From maemo.org wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Sat, 18 Apr 2026 06:26:07 GMT</lastBuildDate>
		<item>
			<title>Repartitioning the flash</title>
			<link>http://bugs.maemo.com/Repartitioning_the_flash</link>
			<guid>http://bugs.maemo.com/Repartitioning_the_flash</guid>
			<description>&lt;p&gt;87.205.192.7:&amp;#32;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several reasons why users might want to repartition their eMMC flash:&lt;br /&gt;
* many Maemo power users have a Linux background. They tend to prefer POSIX filesystems like ext3 over the ancient VFAT filesystem. However, VFAT can be accessed on most non-Linux computers and would be useful to keep a small VFAT partition for data exchange with USB mass storage. With a large ext3 partition you could install much more applications, store symlinks and permissions (e.g., for backup of your desktop PC), or create Linux chroot enviroments (e.g., for installing non-optified software or Debian).&lt;br /&gt;
* booting alternative operating systems (e.g., Mer, Moebian, Fedora) requires independent partitions&lt;br /&gt;
* loopback files for chroots (see [[Easy Debian]]) can be stored in VFAT MyDocs, but access is much slower than on a native partition. loopback files in MyDocs are not available during USB mass storage mode.&lt;br /&gt;
&lt;br /&gt;
==Default partition setup==&lt;br /&gt;
&lt;br /&gt;
By default the eMMC on the N900 (&amp;lt;code&amp;gt;/dev/mmcblk0&amp;lt;/code&amp;gt;) is partitioned as follows:&lt;br /&gt;
# 27 GB VFAT [[MyDocs folder|MyDocs partition]]&lt;br /&gt;
# 2 GB &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; partition&lt;br /&gt;
# 768 MB swap partition&lt;br /&gt;
&lt;br /&gt;
This page describes several possible solutions:&lt;br /&gt;
# [[#Solution .231: swap .2Fhome and MyDocs partition|Swap the 2 GB &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; and 27GB MyDocs partition]] to get a 2 GB VFAT MyDocs and a 27 GB ext3 &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt;. No partition size need to be changed and only a single reboot is necessary. This is the least invasive solution and can be easily reverted. It leaves a smaller MyDocs partition for VFAT USB mass storage mode.&lt;br /&gt;
# [[#Solution .232: shrink MyDocs to add additional partitions|shrink MyDocs to add additional partitions]] (e.g., for other OS). &lt;br /&gt;
# setup an [[#Solution .233: arbitrary size for .2Fhome and MyDocs|arbitrary &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; and MyDocs division of the space]]. this is a little bit more complicated.&lt;br /&gt;
# [[#Solution .234: single large .2Fhome partition.2C loopback for USB|get rid of the MyDocs partition]], setup a single 31 GB ext3 partition, and replace MyDocs with loopback file(s) that could also be USB exported and have arbitrary size and filesystem. This is useful if you rarely need USB mass storage mode or if you want to export different filesystem images depending on the computer. However, the loopback files may be significantly slower. &lt;br /&gt;
&lt;br /&gt;
== What you should know before partitioning ==&lt;br /&gt;
&lt;br /&gt;
* '''BACKUP YOUR DATA''': a mistake during partitioning could brick your device, lead to complete data loss and could require reflashing. Use the Backup application to backup all settings etc. Backup this and the contents of MyDocs to your computer. Remove your optional SD card to prevent data loss. Following this tutorial should minimize your risk of data loss but '''repartitioning is at your own risk'''.&lt;br /&gt;
* make sure your battery is not nearly empty (rebooting costs a lot of power) or, even better, plug in your charger.&lt;br /&gt;
* All instructions must be executed [[root access|as root]] (either from [[Terminal]] or via ssh, type &amp;quot;root&amp;quot; as user to become root).&lt;br /&gt;
* copy &amp;amp; paste is recommended (typos are dangerous). For the table files use &amp;quot;vi&amp;quot; or &amp;quot;cat &amp;gt; table&amp;quot; and Ctrl+D to quit.&lt;br /&gt;
&lt;br /&gt;
== Some remarks ==&lt;br /&gt;
&lt;br /&gt;
* partitions on flash should be aligned to flash block sizes (AFAIK this is 32 KB, but some sources claims 64 KB or 128 KB). To be on the safe side use 128 KB.&lt;br /&gt;
* the only &amp;lt;code&amp;gt;fdisk&amp;lt;/code&amp;gt; utility on the device is &amp;lt;code&amp;gt;sfdisk&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;fdisk&amp;lt;/code&amp;gt; could be extracted from Debian packages but it aligns partitions based on virtual harddisk cylinders and not on flash blocks.&lt;br /&gt;
** to modify the whole partition table use&amp;lt;pre&amp;gt;sfdisk -d /dev/mmcblk0 &amp;gt; table&amp;lt;/pre&amp;gt;edit the file table, and overwrite the partition table with&amp;lt;pre&amp;gt;sfdisk --no-reread /dev/mmcblk0 &amp;lt; table&amp;lt;/pre&amp;gt;&lt;br /&gt;
** ids of single partitions can be changed with&amp;lt;pre&amp;gt;sfdisk -c /dev/mmcblk0 2 83&amp;lt;/pre&amp;gt;(this example changes the 2nd partition to 83=Linux).&lt;br /&gt;
* Maemo hardcodes the MyDocs partition as &amp;lt;code&amp;gt;/dev/mmcblk0p1&amp;lt;/code&amp;gt; in several applications. If you keep a VFAT partition, make sure it is the first partition (partitions in the table do not need to have the same order as on the disk). Otherwise you have to modified several scripts belonging to ke-recv. &lt;br /&gt;
* &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; is the first ext3 partition, swap can be any partition number.&lt;br /&gt;
* the most relevant scripts for partitioning are &amp;lt;code&amp;gt;/etc/event.d/rcS-late&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/usr/sbin/osso-usb-mass-storage-enable.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/usr/sbin/osso-usb-mass-storage-disable.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
* it is not a good idea to unmount &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; in a running system. umounting &amp;lt;code&amp;gt;/home/user/MyDocs&amp;lt;/code&amp;gt; is generally safe (if all applications are closed).&lt;br /&gt;
* you can boot without a &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; partition (for example, by commenting out the line in rcS-late or by change the partition ids to something other than 83). Maemo will create a default home (about 10 MB) on NAND. Most relevant settings (wifi, desktop) are stored on NAND anyway. Make sure to&amp;lt;pre&amp;gt;rm -rf /home/user&amp;lt;/pre&amp;gt; before reboot. This trick is useful if want to change the layout of the eMMC completely.&lt;br /&gt;
* ext3 partitions can be grown online, but not be shrinked.&lt;br /&gt;
* [http://www.gnu.org/software/parted/index.shtml parted] does not work on Maemo (it always crashed due to some mmap problem).&lt;br /&gt;
* if you don't want a VFAT MyDocs partition, you need to create MyDocs/DCIM directory with users permission for the camera app to work [https://bugs.maemo.org/show_bug.cgi?id=7160 proper permissions].&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
'''WARNING: The following instructions have not been tested thoroughly yet!'''&lt;br /&gt;
Please report problems, positive and negative feedback to [mailto:moebian-devel@garage.maemo.org this address].&lt;br /&gt;
&lt;br /&gt;
'''WARNING: Please have a look at [http://talk.maemo.org/showpost.php?p=709886&amp;amp;postcount=191 Titan's comments] Before Proceeding!'''&lt;br /&gt;
It seems that with [[Maemo 5/PR1.2|PR1.2]] release below methods do not work as it is impossible to boot without &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt;. Just so that someone who missed the post doesn't have to reflash 5-6 times after tries &amp;amp; retries only to find it will not work.&lt;br /&gt;
&lt;br /&gt;
Solution #1 Seems to be working fine as &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; is preserved.&lt;br /&gt;
&lt;br /&gt;
=== Solution #1: swap /home and MyDocs partition ===&lt;br /&gt;
TODO, see [http://talk.maemo.org/showpost.php?p=424811&amp;amp;postcount=66 how to swap FAT and ext3 parition]&lt;br /&gt;
&lt;br /&gt;
We assume you have the standard Nokia partition layout on your device.&lt;br /&gt;
&lt;br /&gt;
'''Warning: the contents of MyDocs will deleted. Perform a backup!'''&lt;br /&gt;
&lt;br /&gt;
 umount /home/user/MyDocs&lt;br /&gt;
 sfdisk -c /dev/mmcblk0 1 83 # optional (safer): change FAT to ext3 id &lt;br /&gt;
 mkfs.ext3 /dev/mmcblk0p1 # create ext3 on large partition&lt;br /&gt;
 mount /dev/mmcblk0p1 /mnt # mount new /home&lt;br /&gt;
 cp -a /home/* /mnt # copy contents of /home to large partition&lt;br /&gt;
 umount /mnt # unmount it&lt;br /&gt;
create the file &amp;quot;table&amp;quot;:&lt;br /&gt;
 unit: sectors&lt;br /&gt;
 /dev/mmcblk0p1 : start= 56631360, size=  4194304, Id= c&lt;br /&gt;
 /dev/mmcblk0p2 : start=       64, size= 56631296, Id=83&lt;br /&gt;
 /dev/mmcblk0p3 : start= 60825664, size=  1572864, Id=82&lt;br /&gt;
 /dev/mmcblk0p4 : start=        0, size=        0, Id= 0&lt;br /&gt;
continue with&lt;br /&gt;
 sfdisk --no-reread /dev/mmcblk0 &amp;lt; table # change partition table, swap p1 and p2&lt;br /&gt;
 reboot; exit # reboot to re-read new table&lt;br /&gt;
after reboot&lt;br /&gt;
 mkfs.vfat -F32 /dev/mmcblk0p1  # create VFAT on 2GB partition&lt;br /&gt;
 mount /home/user/MyDocs # mount it&lt;br /&gt;
voila!&lt;br /&gt;
&lt;br /&gt;
==== How to revert ====&lt;br /&gt;
'''Warning: /home must have less than 2 GB usage! MyDocs will be deleted!'''&lt;br /&gt;
&lt;br /&gt;
 umount /home/user/MyDocs&lt;br /&gt;
 sfdisk -c /dev/mmcblk0 1 83 # optional (safer): change FAT to ext3 id &lt;br /&gt;
 mkfs.ext3 /dev/mmcblk0p1 # create ext3 on smaller partition&lt;br /&gt;
 mount /dev/mmcblk0p1 /mnt # mount new /home&lt;br /&gt;
 cp -a /home/* /mnt # copy contents of /home to large partition&lt;br /&gt;
 umount /mnt # unmount it&lt;br /&gt;
create the file &amp;quot;table&amp;quot; (this is the original layout):&lt;br /&gt;
 unit: sectors&lt;br /&gt;
 /dev/mmcblk0p1 : start=       64, size= 56631296, Id=c&lt;br /&gt;
 /dev/mmcblk0p2 : start= 56631360, size=  4194304, Id= 83&lt;br /&gt;
 /dev/mmcblk0p3 : start= 60825664, size=  1572864, Id=82&lt;br /&gt;
 /dev/mmcblk0p4 : start=        0, size=        0, Id= 0&lt;br /&gt;
continue with&lt;br /&gt;
 sfdisk --no-reread /dev/mmcblk0 &amp;lt; table # change partition table, swap p1 and p2&lt;br /&gt;
 reboot; exit # reboot to re-read new table&lt;br /&gt;
after reboot&lt;br /&gt;
 mkfs.vfat -F32 -s64 /dev/mmcblk0p1  # create VFAT on 27GB partition&lt;br /&gt;
 mount /home/user/MyDocs # mount it&lt;br /&gt;
&lt;br /&gt;
=== Solution #2: shrink MyDocs to add additional partitions ===&lt;br /&gt;
TODO, see [https://garage.maemo.org/plugins/wiki/index.php?RepartitionInstructions&amp;amp;id=1382&amp;amp;type=g Repartitioning: create extended partitions]&lt;br /&gt;
&lt;br /&gt;
'''Warning: the contents of MyDocs will deleted. Perform a backup!'''&lt;br /&gt;
&lt;br /&gt;
 umount /home/user/MyDocs&lt;br /&gt;
create a new partition layout in file &amp;quot;table&amp;quot; (here 8 GB MyDocs were used for an extended partition with 3+5 GB partitions):&lt;br /&gt;
 unit: sectors&lt;br /&gt;
 /dev/mmcblk0p1 : start=       64, size= 39854080, Id= 0&lt;br /&gt;
 /dev/mmcblk0p2 : start= 39854144, size= 16777216, Id= 5&lt;br /&gt;
 /dev/mmcblk0p3:  start= 56631360, size=  4194304, Id=83&lt;br /&gt;
 /dev/mmcblk0p4 : start= 60825664, size=  1572864, Id=82&lt;br /&gt;
 /dev/mmcblk0p5 : start= 39854160, size=  9765680, Id=83&lt;br /&gt;
 /dev/mmcblk0p6 : start= 49619856, size=  7011504, Id=83&lt;br /&gt;
continue with&lt;br /&gt;
 sfdisk --no-reread /dev/mmcblk0 &amp;lt; table # change partition table&lt;br /&gt;
 reboot; exit # reboot to re-read new table&lt;br /&gt;
after reboot&lt;br /&gt;
 sfdisk -c /dev/mmcblk0 1 c # optional (safer): change FAT to ext3 id &lt;br /&gt;
 mkfs.vfat -F32 /dev/mmcblk0p1  # recreate VFAT on MyDocs&lt;br /&gt;
 mkfs.ext3 /dev/mmcblk0p5&lt;br /&gt;
 mkfs.ext3 /dev/mmcblk0p6&lt;br /&gt;
reboot and restore MyDocs&lt;br /&gt;
&lt;br /&gt;
=== Solution #3: arbitrary size for /home and MyDocs ===&lt;br /&gt;
TODO, see also [[User:Ruskie#Repartitioning]]&lt;br /&gt;
&lt;br /&gt;
'''Warning: /home and MyDocs will be deleted. Backup everything.'''&lt;br /&gt;
Backup all settings (to your computer or SD), reflash, restore the settings and install rootsh (no other applications!).&lt;br /&gt;
&lt;br /&gt;
create your new partition table layout in the file &amp;quot;table&amp;quot;.&lt;br /&gt;
Make sure all partitions are aligned to 32 KB and sizes are multiples of 32 KB.&lt;br /&gt;
The sectors are 512 bytes, so the block counts must multiplied by 2.&lt;br /&gt;
For example, 2GB= 4194304 blocks. Each partition should start at start+size of the previous partition.&lt;br /&gt;
The first partition must start at 64. Make sure to keep the swap partition (the number may be changed).&lt;br /&gt;
Initially set the id of your partition to 0 so that they are not mounted at reboot.&lt;br /&gt;
An example layout with 2 GB part1 and 27 GB part2:&lt;br /&gt;
 unit: sectors&lt;br /&gt;
 /dev/mmcblk0p1 : start=       64, size= 4194304 , Id=0&lt;br /&gt;
 /dev/mmcblk0p2 : start= 4194368, size=  56631296, Id=0&lt;br /&gt;
 /dev/mmcblk0p3 : start= 60825664, size=  1572864, Id=82&lt;br /&gt;
 /dev/mmcblk0p4 : start=        0, size=        0, Id= 0&lt;br /&gt;
(Optional) Dump your current partition table with the following command&lt;br /&gt;
 sfdisk -d /dev/mmcblk0 &amp;gt; table&lt;br /&gt;
continue with&lt;br /&gt;
 sfdisk --no-reread /dev/mmcblk0 &amp;lt; table # change partition table&lt;br /&gt;
 reboot; exit&lt;br /&gt;
The device creates a default /home in NAND.&lt;br /&gt;
Now change the parition ids and create the file systems&lt;br /&gt;
 sfdisk -c /dev/mmcblk0 1 c&lt;br /&gt;
 mkfs.vfat -F32 -s64 /dev/mmcblk0p1&lt;br /&gt;
 sfdisk -c /dev/mmcblk0 2 83&lt;br /&gt;
 mkfs.ext3 /dev/mmcblk0p2&lt;br /&gt;
if you have change to location or size of swap run&lt;br /&gt;
 mkswap &amp;lt;swap-partition&amp;gt;&lt;br /&gt;
finish with&lt;br /&gt;
 rm -rf /home/user&lt;br /&gt;
 reboot; exit&lt;br /&gt;
finally restore all your backups&lt;br /&gt;
&lt;br /&gt;
=== Solution #4: single large /home partition, loopback for USB ===&lt;br /&gt;
TODO, see [http://talk.maemo.org/showpost.php?p=425359&amp;amp;postcount=68 how to implement USB mass storage with a loopback file]&lt;br /&gt;
&lt;br /&gt;
like solution #3, but don't create a MyDocs partition.&lt;br /&gt;
&lt;br /&gt;
how to create a sparse 1GB loopback file:&lt;br /&gt;
 dd if=/dev/zero of=FAT1GB bs=1M seek=1024 count=0 # small 256MB image&lt;br /&gt;
 losetup /dev/loop0 FAT1GB&lt;br /&gt;
 mkfs.vfat -F32 /dev/loop0&lt;br /&gt;
 vi /etc/fstab # replace /dev/mmcblk0p2 with /dev/loop0&lt;br /&gt;
 mount MyDocs&lt;br /&gt;
&lt;br /&gt;
=== Solution #5: Edit eMMC image (works on PR1.2, by globalbus) ===&lt;br /&gt;
Backup MyDocs, we need to flash device.&lt;br /&gt;
Open eMMC image in hex editor, go to 0xcb, you will see this&lt;br /&gt;
 partition {size = 2048;fs_type = &amp;quot;ext3&amp;quot;;prefix = &amp;quot;home&amp;quot;;}&lt;br /&gt;
Edit size parameter (do not change the size of file! The number must be from 1000 to 9999) Flash it now.&lt;br /&gt;
&lt;br /&gt;
If MyDocs have incorrect size or it's not mounting automatically you need to format it and paste files from backup.&lt;br /&gt;
 umount /dev/mmcblk0p1&lt;br /&gt;
 mkfs.vfat -F32 -s64 /dev/mmcblk0p1&lt;br /&gt;
 mount /dev/mmcblk0p1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://maemo.org/community/brainstorm/view/more_efficient_and_flexible_use_of_internal_flash brainstorm] and [http://talk.maemo.org/showthread.php?t=37869 discussion]&lt;br /&gt;
* [http://talk.maemo.org/showthread.php?t=35122 Repartitioning the flash]&lt;br /&gt;
&lt;br /&gt;
[[Category:Power users]]&lt;br /&gt;
[[Category:N900]]&lt;/div&gt;</description>
			<pubDate>Mon, 23 Aug 2010 14:10:25 GMT</pubDate>			<dc:creator>87.205.192.7</dc:creator>			<comments>http://bugs.maemo.com/Talk:Repartitioning_the_flash</comments>		</item>
	</channel>
</rss>