maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   Repartitioning the Nokia N9 (https://talk.maemo.org/showthread.php?t=91914)

liar 2013-12-02 15:09

Repartitioning the Nokia N9
 
Hi,

i kind of hated that on the nokia N9 there are 3 partitions:
Code:

/dev/mmcblkp1 as MyDocs
/dev/mmcblkp2 as /
/dev/mmcblkp3 as /home

and MyDocs is a huge vfat partition which sucks in my opinion.

So i figured out you could use sfdisk to reformat the partitions while running in harmattan (openmode, don't know if that matters, but i think it doesn't) and even use ext3 or something else as partition type for the new partitions you might add. If you dont want to add a partition you can just set the partition type of partition 1 to Linux, will work just as good but i liked to have a small FAT partition for swapping files between operating systems at home, university and so on...

my partition table looks like this now:
Code:

# /sbin/sfdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 1957120 cylinders, 4 heads, 16 sectors/track
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
/dev/mmcblk0p2    1760512  1891583  131072    4194304  83  Linux
/dev/mmcblk0p3    1891584  1957119  65536    2097152  83  Linux
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux

NOTE that the partition table is out of order, but for me everything works perfectly and i didn't want to touch the rootfs and /home partitions so i'd be safe and don't mess my installation up.

But only the first partition gets registered to a host if connected via usb so i changed /etc/usb-moded/usb-moded.ini to this:
Code:

# cat /etc/usb-moded/usb-moded.ini
[mountpoints]
mount = /dev/mmcblk0p1,/dev/mmcblk0p4

#you can add more filesystems to the mount option, by making it a comma-seperated list.

[sync]
nofua = 1

[altmount]
mount = /home/user/MyDocs,/mnt

[cdrom]
path = /usr/share/aceso/aceso.iso
timeout = 1

Now i can see both partitions on my desktop if connected via usb. I hope this helps.

to use sfdisk to change the first partition use this command (after devel-su):
Code:

/sbin/sfdisk --no-reread /dev/mmcblk0 -N1
(-N1 makes sure you only edit the first partition)
and to modify the 4 partition use (obviously):
Code:

/sbin/sfdisk --no-reread /dev/mmcblk0 -N4
you have to specify start, size and type after you've executed the command. When editing the first partition start should be 16, size should be something you like (i think the program warns you if you choose a too big size) and the type should be c for W95 FAT32 (LBA).
for the fourth partition for start use the end of the first partition +1 and size again something you like (probably everything that is left) and type can be anything you like, i choose L which automatically uses a Linux type for the partition.

step by step execution should look something like this:
(i created this log after i did the setup on my device so the settings where already there, the sfdisk output should be different for you, partition 4 most likely won't exist yet).
Code:

# /sbin/sfdisk --no-reread /dev/mmcblk0 -N1

Disk /dev/mmcblk0: 1957120 cylinders, 4 heads, 16 sectors/track
Old situation:
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
/dev/mmcblk0p2    1760512  1891583  131072    4194304  83  Linux
/dev/mmcblk0p3    1891584  1957119  65536    2097152  83  Linux
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).

/dev/mmcblk0p1 :16 100000 c
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
New situation:
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
/dev/mmcblk0p2    1760512  1891583  131072    4194304  83  Linux
/dev/mmcblk0p3    1891584  1957119  65536    2097152  83  Linux
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Do you want to write this to disk? [ynq] y
Successfully wrote the new partition table

Re-reading the partition table ...
BLKRRPART: Device or resource busy
The command to re-read the partition table failed
Reboot your system now, before using mkfs

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
~ # /sbin/sfdisk --no-reread /dev/mmcblk0 -N4

Disk /dev/mmcblk0: 1957120 cylinders, 4 heads, 16 sectors/track
Old situation:
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
/dev/mmcblk0p2    1760512  1891583  131072    4194304  83  Linux
/dev/mmcblk0p3    1891584  1957119  65536    2097152  83  Linux
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).
/dev/mmcblk0p4 :100016 99999999 L
Warning: given size (32891135) exceeds max allowable size (1660496)
/dev/mmcblk0p4 :100016 1660496 L
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux
New situation:
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1        16  100015  100000    3200000    c  W95 FAT32 (LBA)
/dev/mmcblk0p2    1760512  1891583  131072    4194304  83  Linux
/dev/mmcblk0p3    1891584  1957119  65536    2097152  83  Linux
/dev/mmcblk0p4    100016  1760511  1660496  53135872  83  Linux
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Do you want to write this to disk? [ynq] y
Successfully wrote the new partition table

Re-reading the partition table ...
BLKRRPART: Device or resource busy
The command to re-read the partition table failed
Reboot your system now, before using mkfs

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

Then edit /etc/usb-moded/usb-moded.ini according to your needs. Then reboot the device and hope for the best.

After rebooting you can format the partitions using the mkfs commands, like (after devel-su):
Code:

/sbin/mkfs.vfat /dev/mmcblk0p1
/sbin/mkfs.ext3 /dev/mmcblk0p4

if you want to have it mount your fourth partition if you boot or disconnect the device from usb you need to change your /etc/fstab, i used this:
Code:

# cat /etc/fstab
rootfs / rootfs defaults,errors=remount-ro,noatime 0 0
/dev/mmcblk0p3 /home ext4 rw,noatime,errors=remount-ro,barrier=1 0 0
/dev/mmcblk0p1 /home/user/MyDocs vfat noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir 0 0
/dev/mmcblk0p4 /mnt ext4 rw,noatime,errors=remount-ro,barrier=1 0 0
ubi0:var /var ubifs noauto,no_chk_data_crc,bulk_read


juiceme 2013-12-02 16:30

Re: Repartitioning the Nokia N9
 
I recently repartitioned also, but I made a bit more extensive changes;
  • I wanted to have more partitions for different OS'es
  • I was constantly running out of space on my /home so I increased that also to 4G
  • altough it is OK to have the partitions in mixed order, I like them nice and stacked, hence I put MyDocs as last partition

So this is how my partitition table looks like:

Code:

~ #
~ # /sbin/sfdisk -l

Disk /dev/mmcblk0: 1957120 cylinders, 4 heads, 16 sectors/track
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

  Device Boot    Start    End  #cyls    #blocks  Id  System
/dev/mmcblk0p1      16  131087  131072  4194304  83  Linux
/dev/mmcblk0p2  131088  262159  131072  4194304  83  Linux
/dev/mmcblk0p3  262160  393231  131072  4194304  83  Linux
/dev/mmcblk0p4  393232  1957119  1563888  50044416  5  Extended
/dev/mmcblk0p5  393232+ 524303  131072-  4194296  83  Linux
/dev/mmcblk0p6  524304+ 655375  131072-  4194296  83  Linux
/dev/mmcblk0p7  655376+ 1957119  1301744- 41655800  83  Linux

~ #

The partition assignments are;
  • p1, home, 4GB
  • p2, rootfs, 4GB
  • p3, Nemo, 4GB
  • p5, Sailfish, 4GB
  • p6, Ubuntu, 4GB
  • p7, MyDocs, 40GB

Currently all are formatted as ext4, but as soon as I get btrfs support on ubiboot I am going to try that on my device... :D

eekkelund 2013-12-02 17:05

Re: Repartitioning the Nokia N9
 
I have 16GB version and i wanted to have Harmattan, Nemo and Sailfish booting from different partitions. I made one for Nemo and one for Sailfish. My table looks like this:
Code:

Disk /dev/mmcblk0: 15.8 GB, 15896412160 bytes
4 heads, 16 sectors/track, 485120 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

        Device Boot      Start        End      Blocks  Id System
/dev/mmcblk0p1            252      148100    4731142+  c Win95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary
/dev/mmcblk0p2          288513      419584    4194304  83 Linux
/dev/mmcblk0p3          419585      485120    2097152  83 Linux
/dev/mmcblk0p4          148100      288417    4490167+  5 Extended
Partition 4 does not end on cylinder boundary
/dev/mmcblk0p5          148101      212109    2048256  83 Linux
/dev/mmcblk0p6          212110      288417    2441848+ 83 Linux

Partition table entries are not in disk order

Where
MyDocs 4,5Gb (I dont have that much media there)
rootfs 4,0Gb
home 2,0Gb
Alt_OS 2,5Gb (for Nemo)
Sailfish 2,5 Gb
I made it with KDE Partition Manager. You can see that there is some unused space, but I'm fine with it.. :D..

myname24 2013-12-02 17:33

Re: Repartitioning the Nokia N9
 
Quote:

Originally Posted by juiceme (Post 1391760)
~ # [/CODE]

The partition assignments are;
  • p1, home, 4GB
  • p2, rootfs, 4GB
  • p3, Nemo, 4GB
  • p5, Sailfish, 4GB
  • p6, Ubuntu, 4GB
  • p7, MyDocs, 40GB

A bit OT but did you get ubuntu running on N9 ?

evander_f 2013-12-02 17:35

Re: Repartitioning the Nokia N9
 
Could you link me to a small guide on re partitioning the N9, i cant install Nemo on my N9 16GB, its says 'repartitioning failed' in Moslo. :(

nieldk 2013-12-02 17:39

Re: Repartitioning the Nokia N9
 
Quote:

Originally Posted by evander_f (Post 1391796)
Could you link me to a small guide on re partitioning the N9, i cant install Nemo on my N9 16GB, its says 'repartitioning failed' in Moslo. :(

http://www.thegadgetfreak.net/2012/0...ioning-n9.html

peterleinchen 2013-12-03 20:04

Re: Repartitioning the Nokia N9
 
@evander_f
Were you successful?
Afaik the moslo auto repartitioning should also work on a 16GB version version, assuming you have enough free space on MyDocs, which needs to be > 4 GB. So maybe just free some space on p1 and try again.

amonk 2013-12-24 02:47

Re: Repartitioning the Nokia N9
 
This is my first post here. I've googled my way here many times, looking for some N900 or N9 detail or another in a hurry, but I don't like to have to make web accounts to participate (total nuisance + anti-freedom). I obviously broke down and made an account to post this though, as I've been working on exactly this for a few days now. I've long had an N900 (2 actually), followed by an N9 as well, and never started doing as much as I'd have liked with them until recently (for various pathetic reasons) :( I'm so late digging in deep that it's really a major pain now, considering how Nokia double shafted us loyal, high-end, "phree phonix" customers and all. All the resources I expected to be available are fragmented, broken and/or gone. It's a real spit in the face after having spent some $1800 on their [nice] **** in the last fourish years. Dicks! Oh, what could have been... Real tragedy and all that. Anyway, most of the "docs" for this stuff at least half suck, all Winblows perspective ruined and so on too. And, in this case, they all say "hexaboot" and ****, but then use Nemo's moslo initrd to repartition a SINGLE extra partition (which, of course lamely prevents all the hexaboot boasting). I like things proper and comprehensive. Anyway, here's my N9 filesystem config so far (as seen from my notebook), but I'm not really happy with it yet. I'll probably redo/modify it at least once over the next few days (I haven't laid OSs onto the partitions yet - I did, however, temporarily install Nitdroid into /home/nitdroid [blech!]).

Code:

[root@zardoz] ~/Nokia-N9> parted /dev/sdb unit s print
Model: Linux File-CD Gadget (scsi)
Disk /dev/sdb: 125255680s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start      End        Size        Type      File system  Flags
 1      1024s      10486783s  10485760s  primary  fat32        lba
 4      10486784s  112672767s  102185984s  extended              lba
 5      10487808s  18876415s  8388608s    logical  ext4
 6      18877440s  27266047s  8388608s    logical  ext4
 7      27267072s  35655679s  8388608s    logical  ext4
 8      35656704s  44045311s  8388608s    logical  ext4
 9      44046336s  52434943s  8388608s    logical  ext4
10      52435968s  112672767s  60236800s  logical  ext4
 2      112672768s  121061375s  8388608s    primary  ext4
 3      121061376s  125255679s  4194304s    primary  ext4

Partition assignments are;

p1, Meego MyDocs, 5GiB
p2, Meego /, 4GiB
p3, Meego /home, 2GiB
p5, Debian, 4GiB
p6, Nemo Mobile, 4GiB
p7, Sailfish OS, 4GiB
p8, Firefox OS, 4GiB
p9, Nitdroid, 4GiB
p10, shared space, 28.7GiB

And I made the filesystems as follows (suggestions for better, minimal risk eMMC tuning improvements welcome).

Code:

mkfs.ext4 /dev/sdbX -I 128 -E discard -G 32 -L LabelX -O flex_bg,^huge_file
tune2fs -E mount_opts=journal_async_commit -o discard,acl,user_xattr /dev/sdbX

I patched parted 2.4 (the last version to support filesystem operations like resize, etc.) for a gets bug, introduced via more modern gnulibs, and compiled it on my notebook for said purpose (that moslo initrd "one trick resize pony" was out of the question [though I did examine its autopartition.sh script a bit] -- and it isn't really a "partition resizing wizard" [lol] anyway, y'all; it's a bootloader, at least ostensibly!). What tool abuse?! Besides, I didn't want to be stuck working in some ramdisk anyway. I considered lots of options before fixing up an old parted on my notebook, but that seemed the best approach for me.

The only thing that's really still annoying me is partition alignment. I'm setting this all up via sectors (so, no spooky, automagic hand holding crap) and, unfortunately, the N9 reports insufficient alignment info...

Code:

cat /sys/block/mmcblk0/alignment_offset = 0
cat /sys/block/mmcblk0/mmcblk0p1/alignment_offset = 0
cat /sys/block/mmcblk0/mmcblk0p2/alignment_offset = 0
cat /sys/block/mmcblk0/mmcblk0p3/alignment_offset = 0
cat /sys/block/mmcblk0/queue/physical_block_size = 512
cat /sys/block/mmcblk0/queue/logical_block_size = 512
cat /sys/block/mmcblk0/queue/minimum_io_size = 512
cat /sys/block/mmcblk0/queue/optimal_io_size = 0

...and it's still unhappy with some of the partitions even using 512 byte fallback divisibility. And, of course, my notebook and the N9 itself give different surface lies about its qeometry as well. So, essentially, all "authoritative" information sources are either withholding essential info, lying about it, or both. (lol) If anyone knows its preferred offset information, I'm ready to move on, but I'll keep banging my head as necessary, of course. :) What an unnecessary, largely inexcusable hassle. I don't want to automagic pray it into approximate place. I want to put it *exactly* where I want it via accurate information! Guess I'm unreasonable in 2013, eh (news flash - lol).

Also, I'll almost certainly switch that MyDocs partition to ext4 at some point soonish, (vfat? really? blech!) and maybe combine it with /home. I'd like to change its stupid Winblows originated name too, but I'd have to dig around for lots of hardcoded breakage first, and maybe never find it all. Ug. And I'd like to put the three original filesystems into a sane order too; root first, of course. Vfat MyDocs (double blech!) is partition one?!!1111 Really? What kind of Winblows cretins did they have designing on this thing? I love it, warts and all, of course, but this stuff is downright offensive to the sensibilities. And don't even let me start on that aegis Treacherous Computing BS. Grr!!!!!

Anyway, sorry I blathered and bitched so much along the way here, but I've built up a lot of issues all isolated in my cave over the years. lol ;)

L8r -K

amonk 2013-12-24 03:12

Re: Repartitioning the Nokia N9
 
Also, how much total flash memory your N9 has (16 or 64G) is definitely irrelevant to the autopartition.sh script in moslo's initrd... and it's actual size requirements are...

Code:

        ### Calculate and check partition sizes and limits
        MIN_HARM_FREE_SPACE=$(($NEWPART_SIZE+500*$BLOCKS_PER_MEG))  # require 500 Megs empty space
        MIN_HARM_PART_SIZE=$(($NEWPART_SIZE+3000*$BLOCKS_PER_MEG))  # require 3000 Megs after re-partition
        if [ $HARM_PART_SIZE -gt $MIN_HARM_PART_SIZE -a $HARM_FREE_SPACE -gt $MIN_HARM_FREE_SPACE ]; then

Finally, your error message doesn't say, "'repartitioning failed," evander_f. That string doesn't exist. It says something *like* that, however, I'm sure. Accuracy matters. If you provide the actual [complete and exact] message, I can probably pretty easily tell you *why* it's failing. :)

peterleinchen 2013-12-24 09:30

Re: Repartitioning the Nokia N9
 
Welcome aboard amonk.
What did you want to tell us??? ;)

One thing about amounts of partitions on N9/00:
it does not make sense to create more than 7 partitions (incl. the extended one) due to restrictions of kernel to 8 mmcblk0 devices. Fix exists, but would need self compiled kernel ...


All times are GMT. The time now is 14:39.

vBulletin® Version 3.8.8