[TUTORIAL] How to upgrade to Ubuntu Touch 16.04/RC, by resizing the system partition. - Meizu Pro 5 Guides, News, & Discussion

Ubuntu Touch is a fascinating android-alternative and still under active community development. Meizu Pro 5 was (and still is) one of its flagships. The current RC branch however requires a bigger system partition.
16.04 Stable can be installed on the stock partition but RC can not.
This tutorial assumes that you have a version of Ubuntu Touch already installed (for example via this TWRP backup image). It will not work like this without that.
I used 16.04/Stable. I am mentioning how to back up your userdata but this tutorial will by no means fully restore your old system! Also I am not responsible for any possible errors or data loss!
Alright, lets get started.
Download the ubuntu recovery image here:
We need that later. Put it on your external sd.
We next need to flash TWRP, from here:
This should work over fastboot:
Code:
# fastboot flash recovery TWRP_3.0_m86_patched_st0rm77.img
# fastboot reboot
However, in my case the phone didn't want to make contact. I am not sure if this was an error on my end or a bug in Ubuntu Touch.
You can alternatively boot into (ubuntu) recovery annd open an adb shell from your computer:
Code:
adb shell
Then type:
Code:
DEV=$(ls /dev/block/platform/*/by-name/recovery); echo $DEV
Upload TWRP to your device via adb, by executing from your computer:
Code:
adb push TWRP_3.0_m86_patched_st0rm77.img .
Then flash the recovery using dd:
Code:
dd of=$DEV if=/TWRP_3.0_m86_patched_st0rm77.img
Boot into TWRP recovery.
*Optional: Make now a backup of your userdata on your *external* SD.
Next open an adb shell from your computer:
Code:
adb shell
Code:
/external_sd # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1899196 24 1899172 0% /dev
tmpfs 1899196 56 1899140 0% /tmp
/dev/block/sda43 507848 28872 468492 6% /cache
/dev/block/sda44 56111432 3905764 52189284 7% /data
/dev/block/sda44 56111432 3905764 52189284 7% /sdcard
/dev/block/mmcblk0p1 7798784 7798784 0 100% /external_sd
Unmount the /dev/block/sda partitions:
Code:
/external_sd # umount /data
/external_sd # umount /sdcard
/external_sd # umount /cache
Create an image of your current system and put it on your external sd:
Code:
~ # dd if=/dev/block/sda41 of=/external_sd/system.img
5242880+0 records in
5242880+0 records out
2684354560 bytes (2.5GB) copied, 542.923623 seconds, 4.7MB/s
And the same of custom.img:
Code:
~ # dd if=/dev/block/sda42 of=/external_sd/custom.img
1048576+0 records in
1048576+0 records out
536870912 bytes (512.0MB) copied, 138.687865 seconds, 3.7MB/s
Then we mount said system image:
Code:
~ # mount /external_sd/system.img /system/ -o loop
As well as these:
Code:
~ # mount -t proc proc /system/proc
~ # mount -t sysfs sys /system/sys
~ # mount -o bind /dev /system/dev
And chroot into your current ubuntu touch environment:
Code:
~ # chroot /system/ /bin/bash
bash: groups: command not found
bash: lesspipe: command not found
bash: dircolors: command not found
Then we make sure we actually use the fdisk from util-linux and not that of busybox:
Code:
[email protected]:/# fdisk -V
fdisk from util-linux 2.27.1
And fire it up:
Code:
[email protected]:/# fdisk /dev/block/sda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).
GPT PMBR size mismatch (15267840 != 15267839) will be corrected by w(rite).
Check the current table:
Code:
Command (m for help):
p
The relevant partitions:
Code:
Device Start End Sectors Size Type code Name
dev/block/sda41 65536 720895 655360 2.5G Microsoft basic data 0700 system
dev/block/sda42 720896 851967 131072 512M Microsoft basic data 0700 custom
dev/block/sda43 851968 983039 131072 512M Microsoft basic data 0700 cache
dev/block/sda44 983040 15267834 14284795 54.5G Microsoft basic data 0700 userdata
We now just delete them:
Code:
Command (m for help): d
Partition number (1-3,21-33,41-44, default 44): 41
Partition 41 has been deleted.
Command (m for help): d
Partition number (1-3,21-33,42-44, default 44): 42
Partition 42 has been deleted.
Command (m for help): d
Partition number (1-3,21-33,43,44, default 44): 43
Partition 43 has been deleted
Command (m for help): d
Partition number (1-3,21-33,44, default 44): 44
Partition 44 has been deleted.
And recreate them:
Code:
Command (m for help): n
Partition number (4-20,34-128, default 4): 41
First sector (6-15267834, default 55808): 65536
Last sector, +sectors or +size{K,M,G,T,P} (65536-15267834, default 15267834): 1638399
Created a new partition 41 of type 'Linux filesystem' and of size 6 GiB.
Command (m for help): n
Partition number (4-20,34-40,42-128, default 4): 42
First sector (6-15267834, default 1638400): 1638400
Last sector, +sectors or +size{K,M,G,T,P} (1638400-15267834, default 15267834): 1769471
Created a new partition 42 of type 'Linux filesystem' and of size 512 MiB.
Command (m for help): n
Partition number (4-20,34-40,43-128, default 4): 43
First sector (6-15267834, default 1769472): 1769472
Last sector, +sectors or +size{K,M,G,T,P} (1769472-15267834, default 15267834): 2293775
Created a new partition 43 of type 'Linux filesystem' and of size 2 GiB.
Command (m for help): n
Partition number (4-20,34-40,44-128, default 4): 44
First sector (6-15267834, default 2294016): 2293776
Last sector, +sectors or +size{K,M,G,T,P} (2293776-15267834, default 15267834): 15267824
Created a new partition 44 of type 'Linux filesystem' and of size 49.5 GiB.
The table should look exactly like this:
Code:
Command (m for help): p
Disk /dev/block/sda: 58.2 GiB, 62537072640 bytes, 15267840 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: 00042021-0408-4601-9DCC-A8C51255994F
Device Start End Sectors Size Type
/dev/block/sda1 1024 1279 256 1M Microsoft basic data
/dev/block/sda2 1280 1343 64 256K Microsoft basic data
/dev/block/sda3 1344 1407 64 256K Microsoft basic data
/dev/block/sda21 2048 3071 1024 4M Microsoft basic data
/dev/block/sda22 3072 5119 2048 8M Microsoft basic data
/dev/block/sda23 5120 5631 512 2M Microsoft basic data
/dev/block/sda24 5632 6655 1024 4M Microsoft basic data
/dev/block/sda25 6656 7679 1024 4M Microsoft basic data
/dev/block/sda26 7680 13823 6144 24M Microsoft basic data
/dev/block/sda27 13824 22015 8192 32M Microsoft basic data
/dev/block/sda28 22016 30207 8192 32M Microsoft basic data
/dev/block/sda29 30208 35327 5120 20M Microsoft basic data
/dev/block/sda30 35328 40447 5120 20M Microsoft basic data
/dev/block/sda31 40448 45567 5120 20M Microsoft basic data
/dev/block/sda32 45568 50687 5120 20M Microsoft basic data
/dev/block/sda33 50688 55807 5120 20M Microsoft basic data
/dev/block/sda41 65536 1638399 1572864 6G Linux filesystem
/dev/block/sda42 1638400 1769471 131072 512M Linux filesystem
/dev/block/sda43 1769472 2293775 524304 2G Linux filesystem
/dev/block/sda44 2293776 15267824 12974049 49.5G Linux filesystem
Next we change the partition type to "Microsoft basic data":
Code:
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 41
Partition type (type L to list all types):L
....
11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
The exact number can vary between versions!
Code:
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 42
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 43
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Command (m for help): t
Partition number (1-3,21-33,41-44, default 44): 44
Partition type (type L to list all types): 11
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
Check again with "p", if the types are correct.
Make sure there are no errors:
Code:
Command (m for help): v
No errors detected.
Header version: 1.0
Using 20 out of 128 partitions.
A total of 11396 free sectors is available in 4 segments (the largest is 38 MiB).
Now we add the partition names. For that we first change to expert mode:
Code:
Command (m for help): x
Then
Code:
Expert command (m for help): n
Select partition
Code:
Partition number (1-3,21-33,41-44, default 44): 41
Insert name
Code:
New name: system
Partition name changed from '' to 'system'.
Repeat for the other partitions:
Code:
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 42
New name: custom
Partition name changed from '' to 'custom'.
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 43
New name: cache
Partition name changed from '' to 'cache'.
Expert command (m for help): n
Partition number (1-3,21-33,41-44, default 44): 44
New name: userdata
Partition name changed from '' to 'userdata'.
Leave expert mode:
Code:
Expert command (m for help): r
And write the changes:
Code:
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
This step should not require a reboot unless fdisk specifically says so. If it does, reboot to recovery and restart the adb shell.
So far, so good.
Now we install the filesystems:
Code:
~ # mke2fs -t ext4 -m 0 /dev/block/sda41
~ # mke2fs -t ext4 -m 0 /dev/block/sda43
~ # mke2fs -t ext4 -m 0 /dev/block/sda44
And leave chroot (only if you didn't reboot after fdisk).
[email protected]:/# exit
exit
Now we rewrite the custom.img backup:
Code:
~ # cd /external_sd/
/external_sd # ls
TWRP cache.img custom.img system.img
/external_sd # dd if=./custom.img of=/dev/block/sda42
Reboot recovery and *optional* restore the userdata backup.
Next we hit the Install button, click on "install image" and install the ubuntu-linux recovery image from our sd.
You should now be set, to use the ubtouch installer, from here:
Manually select Meizu Pro 5 and select 16.04/rc with the options: No fastboot, no data wipe.
Happy nerding!
Resources relied upon:
https://blog.matt.wf/flash-your-recovery-image-via-adb-shell-on-android/
https://wiki.ubuntuusers.de/Howto/Installation_Ubuntu_Touch_auf_MEIZU_PRO_5/
https://forum.xda-developers.com/me...hedst0rm77-t3469296/post68868682#post68868682
https://ubuntu-touch.io/de_DE/get-ut

Related

[GUIDE] Restore data from damaged USB Storage

Well, I you are getting message USB Storage damaged and you can't mount USB Storage from Settings > Storage > USB Storage, there is still a chance to save data from that partition. This is how I did it:
1. On phone start SSHDroid
2. Connect to phone with ssh (default password is admin)
Code:
ssh [email protected]<ip_from_SSHDroid>
4. run ''parted'' to determine partition number
Code:
/data/data/berserker.android.apps.sshdroid/home # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
Then enter print
Code:
(parted) print
print
Model: MMC VYL00M (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 4194kB 25.2MB 21.0MB ext4 EFS
2 25.2MB 26.5MB 1311kB SBL1
3 27.3MB 28.6MB 1311kB SBL2
4 29.4MB 37.7MB 8389kB PARAM
5 37.7MB 46.1MB 8389kB KERNEL
6 46.1MB 54.5MB 8389kB RECOVERY
7 54.5MB 159MB 105MB ext4 CACHE
8 159MB 176MB 16.8MB MODEM
9 176MB 713MB 537MB ext4 FACTORYFS
10 713MB 2861MB 2147MB ext4 DATAFS
11 2861MB 15.2GB 12.4GB fat32 UMS
12 15.2GB 15.8GB 537MB ext4 HIDDEN
(parted)
From size column we can determine that our partition number is 11, that means device /dev/block/mmcblk0p11.
5. You can also double check with fdisk
Code:
/data/data/berserker.android.apps.sshdroid/home # fdisk -l /dev/block/mmcblk0p11
Disk /dev/block/mmcblk0p11: 12.3 GB, 12356419584 bytes
4 heads, 16 sectors/track, 377088 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p11p4 1 1 0 0 Empty
Partition 4 does not end on cylinder boundary
5. Now we try to manually mount partition /dev/block/mmcblk0p11
Code:
mount /dev/block/mmcblk0p11 /sdcard/
If no errors are returned, then partition is mounted. Check with
Code:
ls -l /sdcard
6. Now we copy files from phone to pc, on pc run
Code:
mkdir ./sdcard_backup
scp -r [email protected]<ip_from_SSHDroid>:/sdcard/ ./sdcard_backup
7. Now we can format USB Settings > Storage > Format USB storage
8. You should not see notification USB Storage damaged any more
9. Restore files to USB storage, on pc run
Code:
scp -r ./sdcard_backup [email protected]<ip_from_SSHDroid>:/sdcard/

[Q] Corrupt GPT?

I think after running wrong exit_recovery.zip, I managed to trash partition table/GPT - or some other combination of stupidity - hoping someone can help..
CWM Recovery Log
Starting recovery on Mon Jun 25 21:11:17 2012
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (1280 x 800)
ClockworkMod Recovery v5.8.2.0
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null) 0
1 /system ext4 /dev/block/mmcblk0p1 (null) 0
2 /cache ext4 /dev/block/mmcblk0p2 (null) 0
3 /misc emmc /dev/block/mmcblk0p3 (null) 0
4 /staging ext3 /dev/block/mmcblk0p4 (null) 0
5 /data ext4 /dev/block/mmcblk0p8 (null) 0
6 /boot emmc /dev/block/mmcblk0p10 (null) 0
7 /recovery emmc /dev/block/mmcblk0p9 (null) 0
W:Unable to get recovery.fstab info for /datadata during fstab generation!
W:Unable to get recovery.fstab info for /emmc during fstab generation!
W:Unable to get recovery.fstab info for /sdcard during fstab generation!
W:Unable to get recovery.fstab info for /sd-ext during fstab generation!
I:Completed outputting fstab.
Irocessing arguments.
...
[recovery session] Fdisk
/tmp # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 63.5 GB, 63577260032 bytes
4 heads, 16 sectors/track, 1940224 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk /dev/block/mmcblk0 doesn't contain a valid partition table
[recovery session] Parted
/tmp # ./parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0: unrecognised disk label
Hypothesis
By doing exit recovery opt 1a http://forum.xda-developers.com/showthread.php?t=1514088 I was able to bring up the virtuousprime ROM boot, but virtuous failed (reboot) after trying to format /data.
I dd'd the first 8096 bytes of mmcblk0 and they are all zeros?
From CWM, I am able to mount partitions mmcblk0p1, mmcblk0p3, mmcblk0p5.
So from all that, I am thinking I need to flash MBR, replace GPT on LBA 1? If this is correct, does anyone have a stock GPT for the tf201?
I can then format /data (mmcblk0p8) and I think my ROMs will then work.
kind regs,
Based on the information here: https:// en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_.28LBA_1.29, replacing LBA 1 will only fix the GPT header. Since you said that the first 8096 bytes were all zeros, it would seem that those would fall into LBA 2, 3, etc., corrupting the partition table.
But since you said that CWM can mount your partitions, you might be able to use GPT fdisk's recovery features to fix the problem. I don't know if anyone has compiled it for Android though Please note that the regular fdisk cannot handle GPT, only MBR.
When you said "flash MBR", what exactly do you mean? GPT and MBR are two different partition structures and if you replace either one with the other, the partition table will be lost and you won't be able to mount any partition.
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
I have all the partition offsets and disk size from backup (/sys/devices/platform/sdhci-tegra.3/mmc_host/mmc0/mmc0:0001/block/mmcblk0/..) and know what the partition table should look like; there was no "Partition 9", I made this up because there was 1024 unaccounted bytes after mmcblk0p8 (/data) ends:
Disk size: 1241744336 bytes
Partition 1 (/system): start 74752; End 1123328; Size 1048576
Partition 2 (/cache): start 1123328; End 1999872; Size 876544
Partition 3 (/misc): start 1999872; End 2003968; Size 4096
Partition 4 (/staging): start 2003968; End 3096576; Size 1092608
Partition 5 (/btmac): start 3096576; End 3106816; Size 10240
Partition 6 (/?): start 3106816; End 3107840; Size 1024
Partition 7 (/?): start 3107840; End 3118080; Size 10240
Partition 8 (/data): start 3118080; End 124173312; Size 121055232
Partition 9: start 124173312; End 124174336; Size 1024
Given that /system mounts, I think if I had a stock dump from a tf201 of bytes 0-74752 might also be an alternative - I could verify the GPT table against above before I put it in.
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
damonbrisbane said:
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
Click to expand...
Click to collapse
I wouldn't suggest doing that. That would create a hybrid MBR. When a hybrid MBR disk is read using MBR, only the first four partitions can be visible (after redefining the partition table in LBA0). If the disk is read using GPT, all the partitions will be visible. I don't know if Android and Linux prefer MBR over GPT, but if they do, you might lose access to partitions 5-8.
By the way, the '/mbr' option is for the diskpart tool from MSDOS and Windows
damonbrisbane said:
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
Click to expand...
Click to collapse
You're absolutely right. I had forgotten about this. Do you happen to know if those mmcblk0p# partitions are visible when the tablet is plugged into a Linux computer? If so, GPT fdisk can restore the partition table and GPT header from the backup GPT.
You would run something like this to restore the backup GPT:
http://paste.kde.org/488054/
EDIT: I found a version of gdisk compiled for Android by meghd00t (http://forum.xda-developers.com/showpost.php?p=24805392&postcount=74). You may be able to restore the backup GPT directly from the tablet
Download link from the post: http://dl.dropbox.com/u/64885133/gptfdisk.zip
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
damonbrisbane said:
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
Click to expand...
Click to collapse
No problem There's also an option to backup the GPT header and partition table to file. I'd suggest doing that just in case anything goes wrong.
I'm not entirely sure if the internal memory can be accessed directly from Linux. But from what I've been reading in the forums today, it seems that it might not possible (I'm pretty new to Android).
Hopefully gptfdisk will work via adb shell
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Steps Performed
ADB - Write backup GPT to LBA1 mmcblk0
~ # ./gdisk /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Unsupported GPT version in backup header; read 0x00000000, should be
0x00010000
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): r
Recovery/transformation command (? for help): ?
b use backup GPT header (rebuilding main)
c load backup partition table from disk (rebuilding main)
…
? b
Recovery/transformation command (? for help):
? c
Warning! This will probably do weird things if you've converted an MBR to
GPT form and haven't yet saved the GPT! Proceed? (Y/N): Y
Caution! After loading partitions, the CRC doesn't check out!
Recovery/transformation command (? for help): p
Disk /dev/block/mmcblk0: 124174336 sectors, 59.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2E8491CC-AFFC-43B9-B1C4-97D2F258BE1C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 124174302
Partitions will be aligned on 2048-sector boundaries
Total free space is 75709 sectors (37.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 74752 1123327 512.0 MiB 0700 AP
2 1123328 1999871 428.0 MiB 0700 CC
3 1999872 2003967 2.0 MiB 0700 MC
4 2003968 3096575 533.5 MiB 0700 UP
5 3096576 3106815 5.0 MiB 0700 PR
6 3106816 3107839 512.0 KiB 0700 YU
7 3107840 3118079 5.0 MiB 0700 CA
8 3118080 124173311 57.7 GiB 0700 UA
Recovery/transformation command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/block/mmcblk0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
~ #
ADB/CWM - Exit recovery and attempt Virtuousprime ROM install
I then did exit recovery as per 1a http://forum.xda-developers.com/showthread.php?t=1514088
Upon reboot Virtuousprime wouldn't go as far as it got before. I went back into adb shell and did wipe data:
Wipe data/factory reset
Formatting /data
Error mounting /data !
Skipping format...
Formatting /cache
Formatting /sd-ext
Formatting /sdcard/.android_secure...
Error mounting /sdcard/.android_secure!
Skipping format...
Data wipe complete
Note the error on /data. Could not format /data either using the CWM mounts and storage menu. I named the partitions I knew about and formatted /data (mmcblk0p8) from adb shell:
Number Start End Size File system Name Flags
1 38.3MB 575MB 537MB ext4 system
2 575MB 1024MB 449MB ext4 cache
3 1024MB 1026MB 2097kB misc
4 1026MB 1585MB 559MB ext3 staging
5 1585MB 1591MB 5243kB fat32 btmac
...
8 1596MB 63.6GB 62.0GB ext4 data
mke2fs -t ext4 /dev/block/mmcblk0p8
I then found that CWM data/factory reset went through without errors:
Wipe data/factory reset
Formatting /data
Formatting /cache
..
Data wipe complete
And subsequently exit recovery and virtuous prime rom have installed OK, tested across reboot and shutdown
Cheers!
damonbrisbane said:
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Click to expand...
Click to collapse
Haha, I'm glad I was able to help

[Q] ADB Shell help?

As I posted previously about flashing issues and errors which came up with my device I've learned that my partitions were corrupted and nearly all were erased. With some help from developer Mev and other members I was able to get my device working with ADB shell yet the commands seemed to be far out of my lead.
I have an YP-G70 USA (8 Gigs) device.
From what I learned this is the partition to the device, yet the start/ending blocks aren't listed. Would that be a problem?
Code:
Device Size (KiB) Mount Name Notes
/dev/block/mmcblk0 7757824 Internal eMMC disk device
/dev/block/mmcblk0p1 1 Extended partition containing everything else
/dev/block/mmcblk0p5 256 boot.bin Initial+Primary Bootloaders
/dev/block/mmcblk0p6 256 YPG70_8G-0304.pit Partition Information Table
/dev/block/mmcblk0p7 1280 Sbl.bin Secondary Bootloader
/dev/block/mmcblk0p8 1280 Sbl.bin SBL backup
/dev/block/mmcblk0p9 5120 /mnt/.lfs param.lfs param.blk and boot logos - source of recovery loops
/dev/block/mmcblk0p10 10240 /efs efs.rfs WiFi and BT MAC addresses - causes missing lockscreen
/dev/block/mmcblk0p11 7680 zImage Kernel
/dev/block/mmcblk0p12 7680 zImage "Recovery" kernel that is never used
/dev/block/mmcblk0p13 296960 /system factoryfs.rfs System partition
/dev/block/mmcblk0p14 137216 /dbdata dbdata.rfs Various Android/app databases
/dev/block/mmcblk0p15 65536 /cache cache.rfs Cache partition
/dev/block/mmcblk0p16 1970176 /data datafs.rfs Data partition (apps and their data)
/dev/block/mmcblk0p17 5252096 /sdcard userfs_8G.rfs "Emmc" "Usb Storage" - where your media goes
/dev/block/mmcblk1 <varies> External SD Card disk device
/dev/block/mmcblk1p1 <varies> /sdcard/external_sd External SD Card partition
Next thing is, whenever I tried using
Code:
fdisk /dev/block/mmcblk0
and later on creating a prime partition within the settings that I try to use the "e" to extend (says nothing about "l" for logical) which I run out of sectors to create them with. And sadly the only ones that ever come up is mmcblk0p4 or mmcblk0p3.
Just looking for help to get my player back up and running .. it's all I have and use at work since I don't have a phone and really have been trying to get this to work but its difficult so im sorry for bothering..
I don't know what to do after this:
Jistropy said:
As I posted previously about flashing issues and errors which came up with my device I've learned that my partitions were corrupted and nearly all were erased. With some help from developer Mev and other members I was able to get my device working with ADB shell yet the commands seemed to be far out of my lead.
I have an YP-G70 USA (8 Gigs) device.
From what I learned this is the partition to the device, yet the start/ending blocks aren't listed. Would that be a problem?
Code:
Device Size (KiB) Mount Name Notes
/dev/block/mmcblk0 7757824 Internal eMMC disk device
/dev/block/mmcblk0p1 1 Extended partition containing everything else
/dev/block/mmcblk0p5 256 boot.bin Initial+Primary Bootloaders
/dev/block/mmcblk0p6 256 YPG70_8G-0304.pit Partition Information Table
/dev/block/mmcblk0p7 1280 Sbl.bin Secondary Bootloader
/dev/block/mmcblk0p8 1280 Sbl.bin SBL backup
/dev/block/mmcblk0p9 5120 /mnt/.lfs param.lfs param.blk and boot logos - source of recovery loops
/dev/block/mmcblk0p10 10240 /efs efs.rfs WiFi and BT MAC addresses - causes missing lockscreen
/dev/block/mmcblk0p11 7680 zImage Kernel
/dev/block/mmcblk0p12 7680 zImage "Recovery" kernel that is never used
/dev/block/mmcblk0p13 296960 /system factoryfs.rfs System partition
/dev/block/mmcblk0p14 137216 /dbdata dbdata.rfs Various Android/app databases
/dev/block/mmcblk0p15 65536 /cache cache.rfs Cache partition
/dev/block/mmcblk0p16 1970176 /data datafs.rfs Data partition (apps and their data)
/dev/block/mmcblk0p17 5252096 /sdcard userfs_8G.rfs "Emmc" "Usb Storage" - where your media goes
/dev/block/mmcblk1 <varies> External SD Card disk device
/dev/block/mmcblk1p1 <varies> /sdcard/external_sd External SD Card partition
Next thing is, whenever I tried using
Code:
fdisk /dev/block/mmcblk0
and later on creating a prime partition within the settings that I try to use the "e" to extend (says nothing about "l" for logical) which I run out of sectors to create them with. And sadly the only ones that ever come up is mmcblk0p4 or mmcblk0p3.
Just looking for help to get my player back up and running .. it's all I have and use at work since I don't have a phone and really have been trying to get this to work but its difficult so im sorry for bothering..
I don't know what to do after this:
Click to expand...
Click to collapse
You should have created that as an extended partition, not primary. Then go through and create new partitions "n"
I apologize for not giving you quite the right information. I know there's a table here with starting and ending blocks.
For illustration, here's an example of what to enter at the prompts. IGNORE THE BLOCK NUMBERS - it's just an illustration; just notice the extended/logical and the partition numbers.
Code:
[[email protected] ~]$ fdisk mmcblk0
Welcome to fdisk (util-linux 2.22.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xab3ebd8d.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): e
Partition number (1-4, default 1):
Using default value 1
First sector (2048-102399, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399):
Using default value 102399
Partition 1 of type Extended and of size 49 MiB is set
Command (m for help): p
Disk mmcblk0: 52 MB, 52428800 bytes, 102400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xab3ebd8d
Device Boot Start End Blocks Id System
mmcblk0p1 2048 102399 50176 5 Extended
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (4096-102399, default 4096):
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-102399, default 102399): 16383
Partition 5 of type Linux and of size 6 MiB is set
Command (m for help): p
Disk mmcblk0: 52 MB, 52428800 bytes, 102400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xab3ebd8d
Device Boot Start End Blocks Id System
mmcblk0p1 2048 102399 50176 5 Extended
mmcblk0p5 4096 16383 6144 83 Linux
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 6
First sector (18432-102399, default 18432):
Using default value 18432
Last sector, +sectors or +size{K,M,G} (18432-102399, default 102399):
Using default value 102399
Partition 6 of type Linux and of size 41 MiB is set
Command (m for help): p
Disk mmcblk0: 52 MB, 52428800 bytes, 102400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xab3ebd8d
Device Boot Start End Blocks Id System
mmcblk0p1 2048 102399 50176 5 Extended
mmcblk0p5 4096 16383 6144 83 Linux
mmcblk0p6 18432 102399 41984 83 Linux
Command (m for help): w
The partition table has been altered!
Syncing disks.
[[email protected] ~]$
Awe man thank you!! Going to try this out right now I felt bad for messaging you.
Give me like 15 minutes.
Those cover three of the partitions, how do I go about making the rest?
Jistropy said:
Awe man thank you!! Going to try this out right now I felt bad for messaging you.
Give me like 15 minutes.
Those cover three of the partitions, how do I go about making the rest?
Click to expand...
Click to collapse
Just keep going:
Code:
n (new)
l (logical)
<enter> (beginning)
+blocks (size)
and then
Code:
p (print)
to check your work, and
Code:
w (write)
to save changes and exit.
The Block sizes don't matter right?
Jistropy said:
The Block sizes don't matter right?
Click to expand...
Click to collapse
They matter very much. Use the ones from the device. The above was to illustrate the process. It has entirely wrong numbers.
I will have to repeat this process after doing the extended partition:
Code:
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
So what do I do with these?
Code:
First sector (18432-102399, default 18432):
Using default value 18432 (DONT FILL ?)
Last sector, +sectors or +size{K,M,G} (18432-102399, default 102399):
Using default value 102399 (DONT FILL ?)
Should I fill in those with this?
Code:
Device Size (KiB) Mount
/dev/block/mmcblk0 7757824
/dev/block/mmcblk0p1 1
/dev/block/mmcblk0p5 256
/dev/block/mmcblk0p6 256
/dev/block/mmcblk0p7 1280
/dev/block/mmcblk0p8 1280
/dev/block/mmcblk0p9 5120
/dev/block/mmcblk0p10 10240
/dev/block/mmcblk0p11 7680
/dev/block/mmcblk0p12 7680
/dev/block/mmcblk0p13 296960
/dev/block/mmcblk0p14 137216
/dev/block/mmcblk0p15 65536
/dev/block/mmcblk0p16 1970176
/dev/block/mmcblk0p17 5252096
/dev/block/mmcblk1 <varies>
/dev/block/mmcblk1p1 <varies>
Also, how do I do the last two? Just testing things I don't have the numbers so im randomly copying and pasting the number sets.
Jistropy said:
I will have to repeat this process after doing the extended partition:
Code:
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
So what do I do with these?
Code:
First sector (18432-102399, default 18432):
Using default value 18432 (DONT FILL ?)
Last sector, +sectors or +size{K,M,G} (18432-102399, default 102399):
Using default value 102399 (DONT FILL ?)
Should I fill in those with this?
Code:
Device Size (KiB) Mount
/dev/block/mmcblk0 7757824
/dev/block/mmcblk0p1 1
/dev/block/mmcblk0p5 256
/dev/block/mmcblk0p6 256
/dev/block/mmcblk0p7 1280
/dev/block/mmcblk0p8 1280
/dev/block/mmcblk0p9 5120
/dev/block/mmcblk0p10 10240
/dev/block/mmcblk0p11 7680
/dev/block/mmcblk0p12 7680
/dev/block/mmcblk0p13 296960
/dev/block/mmcblk0p14 137216
/dev/block/mmcblk0p15 65536
/dev/block/mmcblk0p16 1970176
/dev/block/mmcblk0p17 5252096
/dev/block/mmcblk1 <varies>
/dev/block/mmcblk1p1 <varies>
Also, how do I do the last two? Just testing things I don't have the numbers so im randomly copying and pasting the number sets.
Click to expand...
Click to collapse
PLEASE have a look around....
http://forum.xda-developers.com/showthread.php?t=1523682
the numbers you want are here within ^post n°8. (value is Kb) and in many other posts!
The last partition n°17, should and must have only some 5gb because your device is 8 gb. Take care to set fdisk with the proper set up between blocks and Bytes and in case of error don't panic, just trail again .
Good luck
sorry lolo9393
Jistropy said:
Okay, rude much?
Your no help, that's for: "CORRECT partition sizes (for 16GB model!):"
As I said above, I have a 8 GIG USA YP-G70.
If your gonna post, maybe you should read more clearly.
Click to expand...
Click to collapse
You follow the table until partition 17 that will show only some "5252096" kb remaining if entered numbers are correct, because you have a 8 Gb device.
I tried to help you with what I know, sorry for my bad english..
Jistropy said:
Okay, rude much?
Your no help, that's for: "CORRECT partition sizes (for 16GB model!):"
As I said above, I have a 8 GIG USA YP-G70.
If your gonna post, maybe you should read more clearly.
Click to expand...
Click to collapse
Please listen th his help. He knows more about it than I do.
i apologize but no matter how i insert those numbers they never come out close
I got up to block 16 but it says i over pass the cylendars
Code:
/dev/block/mmcblk0p16 64181 313396 1993728 83 Linux
/dev/block/mmcblk0p17 313401 1937720 12994560 83 Linux
What do I set for 17 as well?
I can't get the tables to add up to what u got so i copied the start and ending for each.
Stuck on 16/17 need some help.
Edit --
I was able to flash stock! But i get a bunch of errors about opening cache and mounting.
rfs format failed on /dev/block/mmcblk0p15
Jistropy said:
I got up to block 16 but it says i over pass the cylendars
Code:
/dev/block/mmcblk0p16 64181 313396 1993728 83 Linux
/dev/block/mmcblk0p17 313401 1937720 12994560 83 Linux
What do I set for 17 as well?
I can't get the tables to add up to what u got so i copied the start and ending for each.
Stuck on 16/17 need some help.
Edit --
I was able to flash stock! But i get a bunch of errors about opening cache and mounting.
rfs format failed on /dev/block/mmcblk0p15
Click to expand...
Click to collapse
Yes, you were able to flash but your device is still useless because partition 16 and 17 are wrongly built.
may be you entered the right numbers but resulting in wrong recording , check your print (p) attached.
It is perfect until partition 16 beginning..
.Now just delete and rewrite 16 and 17th. (end n°17 by +k instruction will fill the gap and give you the right number or enter 242432 blocks as follow .
Vdev/block/mmcblk0p17 313401 242432 ........... result dotted should give some 5252096 kb.
Then write and print again in order to check your good work and at this point your next flashing will be good! (may be a wipe cache to be sure and avoid bootloop)
other suggestion is you come to my home tomorrow morning in order I arrange that for you!!!!
Cheers
It is perfect until partition 16 beginning..
.Now just delete and rewrite 16 and 17th. (end n°17 by +k instruction will fill the gap and give you the right number or enter 242432 blocks as follow .
Vdev/block/mmcblk0p17 313401 242432 ........... result dotted should give some 5252096 kb.
Then write and print again in order to check your good work and at this point your next flashing will be good! (may be a wipe cache to be sure and avoid bootloop)
Click to expand...
Click to collapse
What do I put for 0p16 then? Sorry I'm making sure i dont mess up
Tried following the same 16 and it went through however for block 17 the number value is too high
Jistropy said:
What do I put for 0p16 then? Sorry I'm making sure i dont mess up
Tried following the same 16 and it went through however for block 17 the number value is too high
Click to expand...
Click to collapse
Quick because it is lunch time here...
P16 is the same as in the 16gb table.
/dev/block/mmcblk0p16 64181 313396 1993728 83 Linux
ok ,got it?
No risk you mess the device, only take care to verify what is done by (p) print instruction and check the written table.
it doesnt allow me to set that value.. im sorry
Jistropy said:
it doesnt allow me to set that value.. im sorry
Click to expand...
Click to collapse
Did you delete the partition before rewriting it?
Should work because you have enough numbers of blocks to fill as said.
If no success do as follow:
delete p16 and 17, then do a write and post the result you get.
here: (I dont have enough space for every 16, or 17)
but im glad you've gotten me this far.
Jistropy said:
here: (I dont have enough space for every 16, or 17)
but im glad you've gotten me this far.
Click to expand...
Click to collapse
Sorry i didn't check it first but you are 4 heads mode (read line 2 of your print) that explain wy your lack of blocks.
You shoud reset fdisk in secondary menu to 1 head like following example
1 heads, 16 sectors/track,
Units = cylinders of 16 * 512 = 8192 bytes
I have no means to open fdisk from here to guide you, but it is easy to find once understood.
I come back in 3 hours time and if you still have pb I'll check for more guidance.
OK?
ADD;
How to change heads number?
select (h) to change number of heads in expert menu (m)
(now you are the "expert") you should get some 970 000 cylinders to split.
For more details:
http://linux.omnipotent.net/article.php?article_id=6979
doing this will allow you to successfully complete your memory table. great!

Multi-Boot RPi from Command Line [31 Oct 2013]

I wrote a shell script to multi-boot my RPi from a terminal. Script can be executed remotely via SSH or VNC.
Features:
Automatically detect all ext4 partitions of all storage devices attached to RPi (ext4 is the default partition type for hosting an RPi-compatible OS)
Reconstruct boot device names (root=/dev/*) from partition editor output. No changes are made to storage devices
Generate table of boot options and prompt user for option
Include option to shutdown
Reboot to selected rootfs, e.g. /dev/sda2 according to user-selected boot option
Script uses partition editor (parted) to identify the storage device paths. I did have to install parted on Raspbmc:
Code:
sudo apt-get install parted
Presently I have triple boot:
Raspbian #1 on SD (/dev/mmcblk0p2)
Raspbian #2 on USB HD (/dev/sda2)
Raspbmc on USB HD (/dev/sda4)
Partition Info:
PNY 16GB SD
[email protected]:/boot# parted /dev/mmcblk0 print
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 62.9MB 16.0GB 15.9GB primary ext4
Western Digital 160GB HD 7200 RPM
[email protected]:/boot# parted /dev/sda print
Model: WDC WD1600BJKT-75F4T (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 77.6MB 21.5GB 21.5GB primary ext4
3 21.5GB 25.8GB 4295MB primary linux-swap(v1)
4 25.8GB 160GB 134GB primary ext4
And here's the boot script (/boot/rpiboot.sh):
Code:
#!/bin/sh
echo
echo "Reboot RPi to rootfs... "
cd /boot
ftxt="cmdline.txt"
fbak="cmdline.bak"
fnew="cmdline.new"
if [ -f $fnew ]
then
rm $fnew
fi
echo
rootfs=$(awk '{for (i=1; i<NF; i++) if (match($i,"root=")) {sub("root=", "", $i); print $i} }' $ftxt)
echo "Current rootfs: $rootfs"
#Reconstructing device names from partition editor output
parted /dev/mmcblk0 print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%sp%d\n", mmcname, $1 > "ext4.txt" }' parted.txt
parted /dev/sda print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%s%d\n", mmcname, $1 >> "ext4.txt" }' parted.txt
echo
echo "Boot options for rootfs:"
cat -n ext4.txt > ext4_enum.txt
more ext4_enum.txt
echo
printf "Enter boot option (press ENTER to shutdown or CNTL-z to exit):"
read -r ext4_index
if test -z "$ext4_index"
then
echo
echo "Shutting down in 3 seconds..."
sleep 3
shutdown -h now
exit 0
fi
#Determine rootfs corresponding to boot option
rootfs=$(awk -v ext4_index=$ext4_index '{if (match($1,ext4_index)) print $2}' ext4_enum.txt)
if test -z "$rootfs"
then
echo
echo "Invalid boot option or other error. Exiting..."
exit 1
fi
awk -v rootfs=$rootfs -v fnew=$fnew '{
for (i=1; i<NF; i++) if (match($i,"root=")) {$i = "root=" rootfs; print $0 > fnew} }' $ftxt
if [ -f $fnew ]
then
printf "Press ENTER to reboot to $rootfs, or CNTL-z to exit."
read -r text
mv $ftxt $fbak
mv $fnew $ftxt
fi
echo
echo "/boot/cmdline.txt:"
more $ftxt
echo "Rebooting to $rootfs in 3 seconds..."
sleep 3
reboot
exit 0
Launching rpiboot.sh as root, here are my own results of a boot switch from /dev/sda2 (Raspbian) to /dev/sda4 (Raspbmc):
Code:
[email protected] ~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/sda2
Boot options for rootfs:
1 /dev/mmcblk0p2
2 /dev/sda2
3 /dev/sda4
Enter boot option (press ENTER to shutdown or CNTL-z to exit):3
Press ENTER to reboot to /dev/sda4, or CNTL-z to exit.
/boot/cmdline.txt:
dwc_otg.lpm_enable=0 root=/dev/sda4 rootfstype=ext4 noatime quiet rootwait loglevel=1 sdhci-bcm2708.enable_l
lm=1 dwc_otg.microframe_schedule=1 dwc_otg.fiq_fix_enable=0 dwc_otg.fiq_split_enable=0 dwc_otg.trans_backoff
=3000
Rebooting to /dev/sda4 in 3 seconds...
Broadcast message from [email protected] (pts/0) (Thu Oct 31 15:28:20 2013):
The system is going down for reboot NOW!
[email protected] ~ $ Connection to 10.0.0.16 closed by remote host.
Connection to 10.0.0.16 closed.
[email protected]:~#
And voila, Raspbmc comes up. I now SSH in from my Ubuntu laptop:
Code:
[email protected]:~# ssh [email protected]
[email protected]'s password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$
Of course VNC renders the elegant desktop experience, and setting up VNC is fairly straightforward:
http://learn.adafruit.com/adafruit-...control-with-vnc/running-vncserver-at-startup
However VNC does not work on Raspbmc since VNC relies on the X11 window system, while Raspbmc’s XBMC implementation is rendered in the framebuffer only. Thus VNC cannot be used as there is no X-session available for connection. See:
http://www.raspbmc.com/wiki/user/frequently-asked-questions/
But SSH works well.
Blessings. Enjoy!
tanks!
hello is verry good
please tuto create multiboot for noobs lol
And Raspbmc is EOL.
help
[email protected]:~ $ df -h
Sys. de fichiers Taille Utilis▒ Dispo Uti% Mont▒ sur
/dev/root 7,2G 4,5G 2,5G 65% /
devtmpfs 364M 0 364M 0% /dev
tmpfs 368M 0 368M 0% /dev/shm
tmpfs 368M 5,3M 363M 2% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 368M 0 368M 0% /sys/fs/cgroup
tmpfs 1,0M 4,0K 1020K 1% /var/pipeyelog
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 74M 0 74M 0% /run/user/1000
/dev/sda3 6,3G 15M 6,0G 1% /media/pi/e836e8e0-22be-4f6e-8836-1f4 039a627e8
/dev/sda2 7,2G 4,5G 2,5G 65% /media/pi/ad6203a1-ec50-4f44-a1c0-e6c 3dd4c9202
/dev/sda1 60M 20M 41M 34% /media/pi/boot
[email protected]:~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/mmcblk0p2
Boot options for rootfs:
1 /dev/mmcblk0p2
Enter boot option (press ENTER to shutdown or CNTL-z to exit):^Z
[1]+ Stopp▒ sudo sh /boot/rpiboot.sh
[email protected]:~ $
why not see my sda2 and sda3 partition ( Raspbian and raspbmc ) ??

[U] [GB+JB] Repartitioning guide

Thanks to @munjeni for tipping me off in the right direction and to @judas1977 + @Tesla-MADAL93 for having done this on the Ace 2 I come from ~~
Everything else in this post applies to Gingerbread, scroll down to the 5th message for a more clear guide centered around a 4.1.2 ROM.
This is my annotated diary about the last 2 hours, I'm sorry if the story feels a little bit Dadaist but I don't want to encourage people who don't feel ready to try it, so please read all of it first and if anything is unclear ask instead of doing!!
I installed Busybox 1.22.1 (iirc) and replaced the default shell with bash (install Bash-X from market, copy /S/xbin/bash over /S/bin/sh, remove app if you like to). All of this was done with Gingerbread .188 and CWM 5.5.0.4 from Supercharged kernel.
Original partition table, with names added:
[email protected]:~$ adb shell
Code:
sh-4.2# fdisk -u -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
4 heads, 16 sectors/track, 242432 cylinders, total 15515648 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 2047 1023+ 0 Empty #### TA ("Trim Area") IMEI, BL UNLOCK, SIMLOCK ETC -- DO NOT TOUCH
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 2304 3327 512 f0 Linux/PA-RISC boot #### SBL? Mem-init? Power management? PARAM?
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 2048 2303 128 f0 Linux/PA-RISC boot #### unknown, as above
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 3328 15269887 7633280 5 Extended #### GROUPS ALL FOLLOWING PARTITIONS FOR THEM TO FIT INTO THE 4-PARTS MBR SCHEME
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 4096 20479 8192 4a Unknown #### another of the 4 unclear partitions
/dev/block/mmcblk0p6 20480 26623 3072 83 Linux #### MODEMFS (Samsung's "EFS") RADIO CALIBRATION
/dev/block/mmcblk0p7 26624 36863 5120 70 Unknown #### no idea either
/dev/block/mmcblk0p8 36864 53247 8192 83 Linux #### IDD (apparently related to usage stats reporting)
/dev/block/mmcblk0p9 53248 86015 16384 48 Unknown #### KERNEL
/dev/block/mmcblk0p10 118784 2215935 1048576 83 Linux #### SYSTEM
/dev/block/mmcblk0p11 2727936 6922239 2097152 83 Linux #### DATAFS
/dev/block/mmcblk0p12 2215936 2727935 256000 83 Linux #### CACHEFS
/dev/block/mmcblk0p13 86016 118783 16384 48 Unknown #### FOTAKERNEL?
/dev/block/mmcblk0p14 6922240 15269887 4173824 c Win95 FAT32 (LBA) #### SDCARD/EMMC/UMS
Partition table entries are not in disk order
so let's rearrange this list for easier thinking & reading
Code:
/dev/block/mmcblk0p1 1 2047 1023+ TA
/dev/block/mmcblk0p3 2048 2303 128 ?
/dev/block/mmcblk0p2 2304 3327 512 ?
/dev/block/mmcblk0p5 4096 20479 8192 ?
/dev/block/mmcblk0p6 20480 26623 3072 MODEMFS
/dev/block/mmcblk0p7 26624 36863 5120 ?
/dev/block/mmcblk0p8 36864 53247 8192 IDD
/dev/block/mmcblk0p9 53248 86015 16384 KERNEL
/dev/block/mmcblk0p13 86016 118783 16384 FOTAKERNEL?
/dev/block/mmcblk0p10 118784 2215935 1048576 SYSTEM
/dev/block/mmcblk0p12 2215936 2727935 256000 CACHEFS
/dev/block/mmcblk0p11 2727936 6922239 2097152 DATAFS
/dev/block/mmcblk0p14 6922240 15269887 4173824 SDCARD
great, the important (for us) stuff is contiguous so we can delete those partitions and recreate them
(if fdisk works like parted we must do that in numerical order, so system>data>cache>ums)
we must delete and recreate partition 13 with the same sizes
OTOH fdisk lets us experiment without saving in real time (!!!) but let's do this in recovery mode
Let's research the sizes we want first -- I find Link2SD's graphical df the best way to do this (see photo 1)
so 540 MB for /system should be enough (I have 454M used, account a safety margin as I integrate updates + FS overhead + 1000 vs 1024 units)
4,14 MB used on /cache... 7,8 MB should be more than enough (same size I used on my Ace 2 which had about 5 MB used there)
this large size is for dalvik cache on ROMs that store it there (vm.dalvik.dexopt-data-only=0 and vm.dalvik.dexopt-cache-only=1 or something)
494 MB on /data, but I'd probably want to change apps and stuff... let's try with 1,25 GB
but if we remove /system we'll have to reflash the rom from a zip, which I'd need to make...
let's leave that partition alone for this first time
reboot now
Click to expand...
Click to collapse
Launching fdisk:
#### SONY
#### SONY (red green blue lightbar)
#### + button
#### CWM-based recovery v5.5.0.4
[email protected]:~$ adb shell
- exec '/system/bin/sh' failed: No such file or directory (2) -
#### No shell in ramdisk? Very lame...
#### [Mounts and storage]
#### [Mount /system, unmount everything else]
[email protected]:~$ adb shell
sh-4.2# fdisk -u /dev/block/mmcblk0
Command (m for help):
What I did in fdisk:
u #### change units to sectors
d #### delete
14
d
13
d
12
d
11
c #### disable cylinder rounding
n #### new
l #### logical partition
First sector (3334-15269887, default 3334): 2215936
Sector 2215936 is already allocated #### Apparently this version of fdisk makes you waste a sector...
First sector (2215937-15269887, default 2215937): Using default value 2215937
Last sector or +size or +sizeM or +sizeK (2215937-15269887, default 15269887): +1600M
#### CACHEFS:
n
l
First sector (3334-15269887, default 3334): 5340938
Sector 5340938 is already allocated
First sector (5340939-15269887, default 5340939): Using default value 5340939
Last sector or +size or +sizeM or +sizeK (5340939-15269887, default 15269887): +8M
#### FOTAKERNEL
n
l
First sector (3334-15269887, default 3334): 86016
Sector 86016 is already allocated
First sector (86017-15269887, default 86017): Using default value 86017
Last sector or +size or +sizeM or +sizeK (86017-118783, default 118783): Using default value 118783
t
Partition number (1-14): 13
Hex code (type L to list codes): 48
Changed system type of partition 13 to 48 (Unknown)
#### USB STORAGE
n
l
First sector (3334-15269887, default 3334): 5356564
Sector 5356564 is already allocated
First sector (5356566-15269887, default 5356566): Using default value 5356566
Last sector or +size or +sizeM or +sizeK (5356566-15269887, default 15269887): Using default value 15269887
c
Partition number (1-14): 14
Hex code (type L to list codes): c
Changed system type of partition 14 to c (W95 FAT32 LBA)
w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy
sh-4.2# reboot
Now enter CWM again and factory reset -- you'll get an error as it can't delete /sdcard/.android_secure as it's unformatted
(and for that matter this CWM can't format /sdcard either...)
No problem apart from skipped heartbeats, boot into Android and format it from the settings! (see photo 2)
Well, the last screenshot speaks for itself... but I'll repeat, don't try this at home! (Have a friend try it so you'll have someone to blame if it gets bricked)
Very interesting... It causes problems?
Inviato dal mio ST25i utilizzando Tapatalk
ale467 said:
Very interesting... It causes problems?
Click to expand...
Click to collapse
Unlike my example, you must have over 50M free on /cache (at least in Gingerbread) or cheat by bind-mounting it somewhere else... or give up on directly installing stuff from the market
I tried bind mounting /cache to /data/local/tmp/cache but Google Play is still broken, so I guess you'll want a 57M partition there...
Also, you can always return to stock layout by flashing a full ROM in green light download mode, then wiping /sdcard from settings
I'm going to update this for 4.1, it's even somewhat easier and more predictable
----------------
1: think of the rough partition sizes
Code:
system (350M)
data (1,5G)
cache (280M) ## keep in mind whether ROM uses this for dalvik-cache and at least in 2.x Google Play downloads there
sdcard (remaining space)
2: make sure you have some files ready
→ROM in recovery zip format
→Backup of everything you want
→Kernel with fdisk in ramdisk
→ADB known working in recovery and normal mode
→Fixed busybox (http://forum.xda-developers.com/attachment.php?attachmentid=1057725&d=1336884034)
3: enter recovery and dump partition table (adb shell, fdisk /dev/block/mmcblk0, p)
Unlike my previous experiment, I'll calculate sizes in cylinders -- harder but fdisk appears to work better that way
Code:
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
4 heads, 16 sectors/track, 242432 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
[...]
/dev/block/mmcblk0p10 1857 34624 1048576 83 Linux #SYSTEM
/dev/block/mmcblk0p11 42625 108160 2097152 83 Linux #DATAFS
/dev/block/mmcblk0p12 34625 42624 256000 83 Linux #CACHEFS
/dev/block/mmcblk0p13 1345 1856 16384 48 Unknown #FOTAKERNEL, move this on another line if it helps you think better but put it back there after calculations
/dev/block/mmcblk0p14 108161 238592 4173824 c Win95 FAT32 #UMS
so our work area starts at cylinder 1857 and ends at 238592!
4: calculate partition sizes (I'll only list start & end cylinders for clarity)
Code:
/dev/block/mmcblk0p10 1857 12538 << 1857 + (350000000÷32768)
/dev/block/mmcblk0p11 12538+1 >> 12539 58315 << 12539+(1500000000÷32768)
/dev/block/mmcblk0p12 58315+1 >> 58316 66861 << 58316 +(280000000÷32768)
/dev/block/mmcblk0p13 1345 1856
/dev/block/mmcblk0p14 66861+1 >> 66862 238592
5: remove partitions (d, 14, d, 13, ..., 10)
6: create partitions (n, l, 1857, 12538, repeat for next row)
7: retype partitions (t, 13, 48, t, 14, c)
8: save changes (w, reboot) - enter recovery again, you should get 5 "E: Can't {mount|open} /cache/[...]" lines
9: go to mounts and storage and run all 4 formats, sdcard will probably fail -- if it doesn't skip to step 13
10: install fixed busybox (adb push '/home/riki/Desktop/busybox' /cache/)
11: enter adb shell, make it executable (chmod +x /cache/busybox)
12: format media partition (/cache/busybox mkfs.vfat /dev/block/mmcblk0p14)
13: quit shell, mount /sdcard in CWM
14: adb push your ROM to /sdcard, install it and reboot!
This is so interesting, I've being doing this on a Samsung Galaxy SCL to fix it as its internal storage and /data partition were totally corrupted. I used parted instead of fdisk to repartition the external SD and edit then kernel's RAM disk to make it mount /data in one of the new partitions. Because of this that I've been doing lately, I'm thinking of using fdisk in my Xperia U too to have more available space in internal SD, that would be great, as I use dual boot feature.
I think I'll do this when I'm be fed up of Jelly Bean being the main ROM and KitKat just the secondary one.
By the way, I think it can be possible to leave enough free space before mmcblk0p14 to create my secondary ROM's partitions there (mmcblk0p15 for /system, mmcblk0p16 for /data and mmcblk0p17 for /cache) instead of creating system.ext4, data.ext4 and cache.ext4 inside my internal SD and mounting them in loop devices... What do you think? Could I brick my phone doing that? I've asked here too just in case.
The only thing I'd have to do is to format my mmcblk0p15 using mke2fs to set the same UUID as in mmcblk0p10 just if my secondary ROM doesn't boot (but I think this wouldn't be necessary):
Code:
mke2fs -T ext4 -O has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -U [COLOR="Silver"][mmcblk0p10's UUID][/COLOR] -I 256 /dev/block/mmcblk0p15
You've explained this how-to so well, @Ryccardo! Thanks for this tutorial.
Many, many thanks to you, sir!
Thanks to you i was able to increase data partition on my P (similar partition scheme to U).
Other tutorials weren't so useful than yours and i was searching quite a lot. Thank you, live in wealth!

Categories

Resources