Creating a large partition and booting off it

(New page: I found it is possible to add a partition to the internal flash card. WARNING: Using this recipe you will loose MyDocs. umount /home/user/MyDocs /home cannot be umounted, unfortunately...)
 
(9 intermediate revisions not shown)
Line 1: Line 1:
 +
{{danger}}
 +
I found it is possible to add a partition to the internal flash card.
I found it is possible to add a partition to the internal flash card.
-
WARNING: Using this recipe you will loose MyDocs.
 
 +
== WARNING: Using this recipe you can lose MyDocs.  == \
 +
However, the most recent user reported happily not to loose it.
 +
Make a backup of MyDocs!
 +
 +
= Creation of the new partition =
  umount /home/user/MyDocs
  umount /home/user/MyDocs
/home cannot be umounted, unfortunately. But this didn't do any harm to /home
/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)
+
Use parted to shrink the MyDocs partition (on my [[Nokia N900|N900]] it was the 1st one)
 +
parted
 +
  (parted) print
 +
  (parted) resize XXXXXX 25GB
 +
Replace XXXXXX with the value given by parted print
reboot
reboot
-
Use fdisk to  
+
Use fdisk to add the 4th partition right after the 1st one
-
# remove the first partition (Because parted makes it not end on a cylinder boundary)
+
-
# recreate the exactly same partition again (this time ending on a cylinder boundary)
+
-
# add the 4th partition right after the 1st one
+
reboot
reboot
-
Enjoy the new partition.
+
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
 +
 
 +
On the new partition, edit the file etc/event.d/rcS-late. Right after
 +
rm -f $fstab_tmp insert the following lines, which you may want to adapt to your needs:
 +
    cat << EOF > $fstab
 +
# marcus-generated 20:11
 +
#rootfs / rootfs defaults,errors=remount-ro,noatime 0 0
 +
/dev/mmcblk0p4 / ext3 rw,defaults,errors=remount-ro,noatime 0 0
 +
/dev/mmcblk0p1 /home/user/MyDocs vfat  noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dm ask=000,fmask=0133,rodir 0 0
 +
/dev/mmcblk0p2 /home ext3 rw,noatime,errors=continue,commit=1,data=writeback 0 0
 +
/dev/mmcblk0p3 none swap sw 0 0
 +
EOF
 +
 
 +
 
 +
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
 +
 
 +
[[Category:Power users]]

Latest revision as of 13:34, 28 May 2010

Image:Ambox_notice.png
Some instructions here may cause serious problems. When unsure, see General precautions
Backing up your data is recommended. In case of trouble you might need to re-flash your device.


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

== WARNING: Using this recipe you can lose MyDocs. == \ However, the most recent user reported happily not to loose it. Make a backup of MyDocs!

[edit] 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 
  (parted) print
  (parted) resize XXXXXX 25GB

Replace XXXXXX with the value given by parted print

reboot

Use fdisk to 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

[edit] 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

On the new partition, edit the file etc/event.d/rcS-late. Right after rm -f $fstab_tmp insert the following lines, which you may want to adapt to your needs:

   cat << EOF > $fstab
# marcus-generated 20:11
#rootfs / rootfs defaults,errors=remount-ro,noatime 0 0
/dev/mmcblk0p4 / ext3 rw,defaults,errors=remount-ro,noatime 0 0
/dev/mmcblk0p1 /home/user/MyDocs vfat  noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dm ask=000,fmask=0133,rodir 0 0
/dev/mmcblk0p2 /home ext3 rw,noatime,errors=continue,commit=1,data=writeback 0 0
/dev/mmcblk0p3 none swap sw 0 0
EOF


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=""

[edit] 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