Friday, April 4, 2008

Dual Booting OS 2008 Step 2: Partitioning

First you need to make sure you have root access, which was described in my previous post. Now we need to partition the ssd/mc card in order to be able to handle both the OS(Operating System, in this case also called the "*rootfs", and storage space for your music/videos etc.

This entire process can be done from your tablet. I always do it from my n800, you can to. It's easy.

Step 1: Unmount the mmc/sd

Since your already root in an xterm (right???) we are going to "unmount" the card. Everything in linux is a file, harddrives, soundcards, your mmc/sd.. all files. Unix "mounts" certain devices to be seen in different locations and to make them accessible. How ever we want to make major changes to that card, so we don't want the OS controlling it.
_
umount /dev/mmcblk0p1
or
umount /media/mmc2

Now to explain what those mean.

umount is the command that removes a mounted location from the system.

/dev/mmcblk0p1 is the hardware device file for the internal card partition 1

mmcblk0 == internal card
mmcblk1 == external card
p1 == partition 1;p2 == partition 2;etc

If you are in the dir anywhere, or maybe have extended memory running on the card it won't unmount.. stop playing music, cd out of the dir, turn off your extended virtual memory.. try again.

Step 2: Partition the card

We need some tools for formating and partitioning so we have to do two things

First we have to add a new repository to our applications list.

To add a repository Click
MENU - > SETTINGS -> APPLICATION MANAGER

Then click on the file button or the title bar of Application manager and select TOOLS -> APPLICATION CATALOG

We want to add a repository so click NEW.

Catalog name: Maemo Repository
Web address: http://repository.maemo.org/
Distribution: bora
Components: free non-free

Make sure that "disabled" is unchecked

Click OK, then click CLOSE

Ok, now back in xterm as root

apt-get install e2fsprogs

now that thats installed. We are going to use sfdisk to partition the card. Sfdisk is kinda clunky and no user-friendly... however its on the tablet.

Start the app with this command

sfdisk -uM /dev/mmcblk0

the -uM means display and accept Megabyte units, and you remember that /dev/mmcblk0 is your internal card

Now once your in there you need to setup 4 partitions.. well really just two but its gonna make you set up 2 empty ones too.. don't worry it will make sense.

I am going to use my card as an example, you can modify fairly easily. I have a 2 gig sd card. I am going to give 356 megs to my first partition for use by the applications for music and files and what not, and approximately 1.6 gigs for my rootfs(where the os and applications go). I am going to show all for lines of entry, then explain them.

,356,6
,,L
,,
,,

Ok, sfdisk is configured with three items per line sepearted by ",". The first item is the starting point. We leave it blank to use default, or the next point in line. The second spot is the ending spot. In the first line I defined it to stop 356 megs into the card and in the second left it blank because I wanted to use the rest of the space. The third spot is for filesystem type. 6 is a fat16 type and L is a linux partition type(also called a type 83). The last two lines are completely empty because there is no where to start, and no where to end because there is no more space. When prompted to write the information you can type y. Don't worry about any warnings.. its an old format tool and not aware of the advances in linux.

Step 3: Formating the partitions

Now that our partitions are cut, we can begin to format them. Formating a partition gives it space usable by the OS.

The first partition we are going to format fat16 so that its usable by windows via usb and the tablets software can access it just like it could before you formated.

*The difference between the rootfs and the initfs is that the initfs is part of your firmware, replaced by flashing. It holds the kernel, that part of the unix OS that handles everything else. The rootfs is the userspace file system. All your applications, device files, program libraries etc go here. The following command will handle this

mkdosfs /dev/mmcblk0p1

As you recall mmcblk0p1 is the internal card, partition 1. The second partition we will format for the rootfs a filesystem type called EXT2.

mke2fs /dev/mmcblk0p2

mmcblk0p2 = second partition.

Now its all done. For the system to be able to recognize these partitions we have to reboot. The easiest way at this point is from the xterm using the shutdown command.

shutdown -r now

The -r means reboot, a -h would mean halt, or turn off. The "now" part defines when this action should happen. After reboot the first partition should operate just like the card did before the partitioning, and the second partition will be discussed in the next section

** Usual props to sites I get tablet info from
www.internettablettalk.com and www.maemo.org

Most of the information in this post was double checked from http://maemo.org/maemowiki/HowTo_EASILYPartition_your_MMC_card

1 comment:

Slathory said...

If you want to create partition usable by windows via usb and the tablets software larger than 4Gb you need to use command 'mkfs.vfat /dev/mmcb1k0p1' to format it instead of 'mkdosfs /dev/mmcblk0p1' because mkdosfs format it in fat16 which limited by 4gb. p.s.Thank you Schmot for the great guide!