maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Repartition the internal drive (https://talk.maemo.org/showthread.php?t=35122)

babyshamie 2011-01-17 22:02

Re: Repartition the internal drive
 
it looks like this==>

BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ sudo gainroot
Root shell enabled


BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user # sfdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 977024 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 1 884864 884864 28315648 83 Linux
/dev/mmcblk0p2 884865 950400 65536 2097152 83 Linux
/dev/mmcblk0p3 950401 974976 24576 786432 82 Linux swap / Solaris
/dev/mmcblk0p4 0 - 0 0 0 Empty
/home/user # mount
rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (rw,bulk_read,no_chk_data_crc)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw,noatime,size=1024k)
tmpfs on /var/run type tmpfs (rw,nosuid,noatime,size=256k,mode=755)
none on /dev type tmpfs (rw,noatime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,noatime,size=65536k)
/dev/mmcblk0p1 on /home type ext3 (rw,noatime,errors=continue,commit=1,data=writebac k)
/home/opt on /opt type none (bind)
nodev on /sys/kernel/debug type debugfs (0)
/opt/pymaemo/usr/lib/python2.5 on /usr/lib/python2.5 type bind (bind)
/opt/pymaemo/usr/share/pyshared on /usr/share/pyshared type bind (bind)
/opt/pymaemo/usr/lib/pyshared on /usr/lib/pyshared type bind (bind)
/opt/pymaemo/usr/share/python-support on /usr/share/python-support type bind (bind)
/opt/pymaemo/usr/lib/python-support on /usr/lib/python-support type bind (bind)
/dev/mmcblk1p1 on /media/mmc1 type vfat (rw,noauto,nodev,noexec,nosuid,noatime,nodiratime, utf8,uid=29999,shortname=mixed,dmask=000,fmask=013 3,rodir)
/home/user #

michaaa62 2011-01-17 22:22

Re: Repartition the internal drive
 
Looks good so far, before carrying on assure yourself that it worked
Code:

df
Read the desired size for /home, aka optfs. But you have to apply a new partition table, because having MyDocs in the first partition is somehow hardcoded in Maemo.
Now after you are assured carry on with first
Code:

sudo gainroot
followed by this one command over these 5 lines
Code:

echo "unit: sectors
> /dev/mmcblk0p1 : start= 56631360, size= 4194304, Id= c
> /dev/mmcblk0p2 : start= 64, size= 56631296, Id=83
> /dev/mmcblk0p3 : start= 60825664, size= 1572864, Id=82
> /dev/mmcblk0p4 : start= 0, size= 0, Id= 0" > table

It parses the text between the "" to the file named table. Then apply the table to your device
Code:

sfdisk --no-reread /dev/mmcblk0 < table
Now reboot again to make that partition setup known to the kernel
Code:

reboot
After reboot carry on with creating the filesystem for MyDocs partition and mount it
Code:

sudo gainroot
mkfs.vfat -F32 -n MyDocs /dev/mmcblk0p1
mount /dev/mmcblk0p1 /home/user/MyDocs

Voila, your done!

babyshamie 2011-01-17 22:55

Re: Repartition the internal drive
 
Quote:

Originally Posted by michaaa62 (Post 922640)
Looks good so far, before carrying on assure yourself that it worked
Code:

df
Read the desired size for /home, aka optfs. But you have to apply a new partition table, because having MyDocs in the first partition is somehow hardcoded in Maemo.
Now after you are assured carry on with first
Code:

sudo gainroot
followed by this one command over these 5 lines
Code:

echo "unit: sectors
> /dev/mmcblk0p1 : start= 56631360, size= 4194304, Id= c
> /dev/mmcblk0p2 : start= 64, size= 56631296, Id=83
> /dev/mmcblk0p3 : start= 60825664, size= 1572864, Id=82
> /dev/mmcblk0p4 : start= 0, size= 0, Id= 0" > table

It parses the text between the "" to the file named table. Then apply the table to your device
Code:

sfdisk --no-reread /dev/mmcblk0 < table
Now reboot again to make that partition setup known to the kernel
Code:

reboot
After reboot carry on with creating the filesystem for MyDocs partition and mount it
Code:

sudo gainroot
mkfs.vfat -F32 -n MyDocs /dev/mmcblk0p1
mount /dev/mmcblk0p1 /home/user/MyDocs

Voila, your done!


thax.thax.thax..very much, I can now access it,wooo..but i have 25gb for installing apps and 2gb on MyDocs,,but its does not really matter though i wanted only 8gb for installing apps...thx again

michaaa62 2011-01-17 23:23

Re: Repartition the internal drive
 
Quote:

but i have 25gb for installing apps and 2gb on MyDocs,,but its does not really matter though i wanted only 8gb for installing apps
Man, you mentioned solution #1 here http://talk.maemo.org/showpost.php?p...&postcount=264
If you really want to repartition 8GB optfs and 24 GB MyDocs you have to backup all your stuff, because during the procedure both are deleted and one after the other rebuild from the backup like in solution #3
http://wiki.maemo.org/Repartitioning_the_flash

n900shamie 2011-01-18 06:11

Re: Repartition the internal drive
 
can anyone explain and give a table of how to have 10gb for install and the rest for MyDocs,i couldnt manage with the ideas provided on wiki.
thx

michaaa62 2011-01-18 07:44

Re: Repartition the internal drive
 
Quote:

Originally Posted by n900shamie (Post 922829)
can anyone explain and give a table of how to have 10gb for install and the rest for MyDocs,i couldnt manage with the ideas provided on wiki.
thx

Make sure you understand the solution fully, know about the risks of loosing everything if you not backup properly!
Read, digest, understand or ask your questions before doing something irresponsible, it saves your nerves!!!
This is the table for solution #3 only. It is the temporary table because of the two zero'ed partition type entries, which will not get mounted during reboot!
Code:

echo "unit: sectors
> /dev/mmcblk0p1 : start= 64, size= 39854080, Id=0
> /dev/mmcblk0p2 : start= 39854144, size= 20971520, Id=0
> /dev/mmcblk0p3 : start= 60825664, size= 1572864, Id=82
> /dev/mmcblk0p4 : start= 0, size= 0, Id= 0" > table

The types of the partitions will get changed later in solution #3 of the wiki http://wiki.maemo.org/Repartitioning...ome_and_MyDocs

Edit: Documentation of the calculation:
Start from the end, swap partition will not get changed [ignore it]. The first partition must start at 64!!!
Code:

10G=1024*1024*10*2=20,971,520 Sectors is the size of partition2
60825664 minus 20,971,520 = 39854144 is the starting value for partition2
39854144 minus 64 = 39854080 is the size of partition!

These three calculations will give you all the numbers for the table above.

n900shamie 2011-01-18 15:39

Re: Repartition the internal drive
 
i have tried the procedure that u just gave three times now but i still have the same memory style after the process..can u give a whole procedure for 10gb for installing plzz.

lalomartins 2011-01-18 16:22

Re: Repartition the internal drive
 
This is now fixed, I have my N900 running with ext4 MyDocs and no problems. My booting issues were due to the awk madness that generates the fstab (why???) barfing on two partitions having the same type. I disabled the whole thing and went with a static fstab like most linux systems in this reality.

Quote:

Originally Posted by lalomartins (Post 920230)
For me the motivation wasn't size, as I was satisfied with the partitioning, but I wanted MyDocs in a filesystem that preserves permissions (especially fed up with every file having +x when copied out of there).

I formatted it as ext4, changed a pile of scripts (there are instructions on page 18 of this topic), and actually remembered to change the ownership of the whole filesystem to the user before I even tried to use the camera — meaning I never actually experienced camera issues.

Right now I'm happily using my n900 with an ext4 MyDocs, no problems yet.

One thing I have to note though, since my uid on my work/home computers is obviously not the same, I had to do something to be able to write to MyDocs when mounted with mass storage. Best way to do that was with POSIX ACLs; man setfacl is your friend.


kyllerbuzcut 2011-01-18 16:45

Re: Repartition the internal drive
 
You can repartition and create new partitions WITHOUT losing any data with gparted. I managed it so anyone can. Just create a bootable cd. I did this even though I have a windows pc. When the machine boots off the cd, plug n900 in and resize the partitions. Took about 15 minutes from start to finish for me. I created a new partition of 2gb for android then gave home an extra 2gb, stealing 4gb from MyDocs. I can find the links or make a howto or something if really needed, but I think if I can do it when I'm a real n00b then anyone can.

brahim98 2011-01-18 17:58

Calculate partition size
 
Hello,
Here is a method to calculate the partition's table.
You must know that a bloc is 32k and it's better to use boundaries at 256k.
To calculate a size the rule is to change to KB and divide by 32.
Maybe an example will make it clearer :
To keep it simple, let's assume that you want at most 4 partitions.
1) Choose a partitionning layout
in my example
Quote:

p1=remaining (21GB) as fat, p2=8GB as ext3, p3=512MB as swap, p4=128MB as ext3
2) Get the highest block number of your device
Code:

sfdisk -l /dev/mmcblk0 | grep mmcblk | grep -v Empty | tail -n 1 | awk '{print $3;}'
This gives me 974974 (you can have a different number because i calculate the last used bloc)
3) Calculate the highest 256k bloc number
high256k=int((974974+1)/8)*8
Quote:

974974+1=974975
974975/8=121871.88
121871*8=974968
we have a difference of 974974-974968=6 blocs that will be added to the last partition
4) calculate the 4th partition
Quote:

size=128MB=128*1024KB=131072KB=131072/32 blocs=4096 blocs
add 6 blocs
Quote:

4096+6=4102 blocs
we know the end bloc and the size :
Quote:

end bloc=974974
size=4102
let's calculate the beginning bloc :
Quote:

beginning=974974-4102=970872
that is also the end of the 3rd partition
5) calculate the 3rd partition (it's nearly copy and past from 4)
Quote:

size=512MB=512*1024KB=524288KB=524288/32 blocs=16384 blocs
we know the end bloc and the size :
Quote:

end bloc=970872
size=16384
let's calculate the beginning bloc :
Quote:

beginning=970872-16384=954488
you guessed right ! that is also the end of the 2nd partition
6) calculate the 2nd partition (also the same as above)
Quote:

size=8GB=8*1024MB=8192MB=8192*1024KB=8388608KB=838 8608/32 blocs=262144 blocs
we know the end bloc and the size :
Quote:

end bloc=954488
size=262144
let's calculate the beginning bloc :
Quote:

beginning=954488-262144=692344
And yes, that's the end of the 1st partition too
7) calculate the 1st partition (the easiest part)
we know the start and end blocs
Quote:

end bloc=692344
beginning=0 (*)
let's calculate the size :
Quote:

size=692344-0 blocs=692344 blocs
Congratulations ! You just finished the caclulation of your partitions !
One last thing :
the type of partition is c for fat, 82 for swap and 83 for ext3
using sfdisk you just have to give beginning, size and type for each partition
----------------
(*) : I haven't any issue beginning with 0, the default is 1, many says to begin with 64 (losing 2MB)


All times are GMT. The time now is 19:13.

vBulletin® Version 3.8.8