Resize Partitions - Sony Xperia M4 Aqua

Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
===[ Update 5.12.2016 ]===
Yes !
I've attatched my scripts to this initial post. Howto follows ...

i can tell you that something similar worked on lg g2 mini (d610/d618)
that phone have a cache partition with 1gb of unused storage, so a developer resized to reduce this to 100mb, you can find this on L90 or g2 mini forum

did you try it yet?

try and give info

resize partitions Script
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?

klarseher said:
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?
Click to expand...
Click to collapse
try and give info

Flashing stock with Flashtool should restore official partition table.

bootloop now ...
ch3mn3y said:
Flashing stock with Flashtool should restore official partition table.
Click to expand...
Click to collapse
As a first step, I have only risized the system partition. The files were backuped with "tar cpf" and restored with "tar xpf" in the recreated partition.
I could see the files in the partion, but the phone does not startup "normal".
I had to use the hidden off button near the SD-slot to power off the phone. Flashing didn't resolved the problem. There is an error while writing system.sin - probably because the partition is to small.
Maybe i have to downgrade flashtool, as mentioned in http://forum.xda-developers.com/showpost.php?p=62751375&postcount=3 ???
Next step would be to "unbrick" my phone. With original system partition, i will only backup and restore the content, to see, if "tar" is able to do the job. Second try with TWRP Backup.

Hello,
I could be wrong, but I think your bootloop problem would probably comes from some sort of SONY extra protection layer.
This additional security system is called RIC and prevents you from freely modifying the system partition at runtime by blocking r/w mount of the system partition.
There is also a default Android security that checks the system partition against a hardcoded hash on boot, to prevent system partition modification (maybe partition size is part of the check operation...).
So you may try to disable the first protection (look at Z5 tutorial) and/or look for a way to bypass the boot check (not sure if possible).
Regards.

system parttion successfull shrinked
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #

klarseher said:
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #
Click to expand...
Click to collapse
give flashable zip

Increasing userdata worked the same way. Backup userdata with TWRP, delete partition 29, create partition 29 with new last sector. Restore with TWRP.
( I've lost adoptive storage in this step - but this is okay, because adoptive storage is to slow for me )
Now userdata on my phone has 4.9 GIB.
To do the same, you have to read and understand.
There is no flashable zip - you will resize your partitions after removing unused stuff from system partition. You have to deal with sgdisk on the TWRP cmdline ( adb shell)

klarseher said:
Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
Click to expand...
Click to collapse
When you remove or delete any system app the folder & ink may get deleted but odex file of original stock rom remains in odex folder as squashed this way you can free up at least 200 to 300 mb.
I have tested it on LP.
& As per my assumption the squashed odexes got nothing to do with selinux as it only load images from squashed folder.

rebuild odex.system.sqsh
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...

howto
klarseher said:
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...
Click to expand...
Click to collapse
The solution:
- install CentOS 7 in VirtualBox
Get odex.system.sqsh from phone ( Phone in TWRP Mode):
adb pull /system/odex.system.sqsh .
Copy odex.system.sqsh to CentOS ( via shared folder)
As root:
- yum install squashfs-tools
- unsquashfs odex.system.sqsh # you got a lot of warnings, because unsquashfs is not allowed to access selinux attributes
- rm -rf squashfs-root # remove for next try
- grep unsquashfs /var/log/audit/audit.log | audit2allow -M mypol
- semodule -i mypol.pp
- unsquashfs odex.system.sqsh
Now, remove unused stuff inside squashfs-root folder
mksquashfs squashfs-root/ odex.system-new.sqsh -comp xz -noI -noF -noX -no-fragments -no-duplicates
---
In TWRP -adb shell:
cd /system
touch dummy
chcon --reference=system.odex.sqsh dummy
rm system.odex.sqsh
# Copy from pc with
adb put odex.system-new.sqh /system/
Back in adb shell:
mv odex.system-new.sqh odex.system.sqh
chcon --reference=dummy system.odex.sqsh
---
The cleanaup in squashfs-root depends on you debloating. I have build my delete script on file lists from /system before and after removing unwanted apps. ( diff before/after | grep '\.odex$')
As a final step, i shrinked my system partion to 1.5 GB ( from original 2.5) and increased /data to 5.1 GB.

Very cool and great job! Maybe try making a step by step tutorial during your free time? Could benefit us all

partitions in DiskInfo
See layout of /data and /system partitions on my phone

klarseher said:
See layout of /data and /system partitions on my phone
Click to expand...
Click to collapse
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !

manhquyet90 said:
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !
Click to expand...
Click to collapse
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards

klarseher said:
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards
Click to expand...
Click to collapse
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\MQ>adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
YT911B19A1 recovery
C:\Users\MQ>adb shell
~ # ←[6nmount /system
~ # ←[6nfind /system -type f > /external_sd/system_filelist.lst
~ # ←[6nmount /system
mount: mounting /dev/block/mmcblk0p30 on /system failed: Device or resource busy
~ # ←[6ndf -k /system
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p30
2531076 2448068 66624 97% /system
~ # ←[6nsgdisk --print /dev/block/mmcblk0
CANNOT LINK EXECUTABLE: cannot locate symbol "__register_atfork" referenced by "
sgdisk"...
page record for 0x7f91ab0010 was not found (block_size=64)
~ # ←[6n

Related

[Q] MKFS.EXT4 Compiled for Android

I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Found one! It's 3 MBs though, so if anyone has a smaller one, it would be very nice.
msticninja said:
I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Click to expand...
Click to collapse
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Click to expand...
Click to collapse
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
shklifo said:
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
Click to expand...
Click to collapse
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
msticninja said:
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
Click to expand...
Click to collapse
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
mount /dev/mmcblk1p2 /tmp/tmproot
Click to expand...
Click to collapse
with
mount /dev/mmcblk0p2 /tmp/tmproot
Click to expand...
Click to collapse
shklifo said:
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
with
Click to expand...
Click to collapse
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
msticninja said:
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
Click to expand...
Click to collapse
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
wdl1908 said:
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
Click to expand...
Click to collapse
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
wdl1908 said:
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
Click to expand...
Click to collapse
For me too, it have nothing to do with a reboot to load partitions table and access partition to format them with the choised filesystem.
You can delete any partition on linux (except rootfs one ), recreate them and directly format them as you like, reboot isn't necesary.
Thanks for all the replies, very helpful, but I'm stuck. Fdisk seems to use ioctl to reload the partition table, so you don't need a reboot if everything on the device is unmounted before writing the partition table, but I'm having very strange issues with mke2fs now. I've had the whole thing work twice now, but when I flash back to stock, then retry the script, it usually does everything except the formatting. Here's the code:
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
umount /dev/mmcblk0p3
umount /dev/mmcblk0p4
fdisk /dev/mmcblk0 < /home/fdisk.input
mv /tmp/mnt/mysticfw.tar.gz /tmp/mnt/mysticf.tar.gz
sync
umount /tmp/mnt
log_and_reboot
fi
if [ -f /tmp/mnt/mysticf.tar.gz ]; then
rm /etc/mtab
touch /etc/mtab
mke2fs -T ext4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk0p2 /tmp/tmproot
tar -xzf /tmp/mnt/mysticf.tar.gz -C /tmp/tmproot/
sync
mv /tmp/mnt/mysticf.tar.gz /tmp/mnt/mysticdone.tar.gz
umount /tmp/tmproot
rm /etc/mtab
ln -s /proc/mounts /etc/mtab
fi
sync
umount /tmp/mnt
I have it reboot after the fdisk just in case, and the fdisk works perfectly, so the second IF/THEN is the issue. I had to retouch the mtab just to make sure it's empty, as mke2fs fails if mtab doesn't exist(at least in terminal), then I relink it to /proc/mounts as they do in the stock firmware. Here's my mke2fs.conf:
Code:
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
}
ext4dev = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
options = test_fs=1
}
small = {
blocksize = 1024
inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_size = 128
inode_ratio = 8192
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = -1
}
largefile4 = {
inode_ratio = 4194304
blocksize = -1
}
hurd = {
blocksize = 4096
inode_size = 128
}
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
msticninja said:
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
Click to expand...
Click to collapse
Simple append (">>") and "echo" doesn't work to a redirected logfile?
I've only learned what I've needed to learn over the years, usually with endless google searches and reading through man pages, so I've never tried to log outputs, because I could always see the output in a terminal or onscreen during boot. Android is the first time I haven't been able to actually see the boot process.
Once again, thanks for your help. I probably could've googled this, but I kind of asked as an afterthought. I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Also, thanks for your original thread about booting from Internal Storage, I never got around to developing on Android until you posted that, and I realized just how similar Android is to L/unix(e.g. exactly the same).
msticninja said:
I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Click to expand...
Click to collapse
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
shklifo said:
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
Click to expand...
Click to collapse
Strange. The google searching lead me to believe the "2>&1" was before the location, and replaced ">>". Once again, thanks for the help.
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
TjaXanK said:
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
Click to expand...
Click to collapse
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
msticninja said:
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
Click to expand...
Click to collapse
ok, I'm currently running urk with the new install system and it's brillant but it would be perfect if we could run it without cutting down on our storage space

[Q] Debian AlternativeOS fails in Uruk 1.5

I plug my Archos 101 into my laptop and copy an unarchived Debian rootfs image to rootfs.img, unmount, unplug and reboot. In the alternative OS menu, I choose Debian and stock Android boots. When I mount the image, it looks fine.
Is AlterntativeOS working in 1.5? If so, where might I be going wrong?
pengyo said:
I plug my Archos 101 into my laptop and copy an unarchived Debian rootfs image to rootfs.img, unmount, unplug and reboot. In the alternative OS menu, I choose Debian and stock Android boots. When I mount the image, it looks fine.
Is AlterntativeOS working in 1.5? If so, where might I be going wrong?
Click to expand...
Click to collapse
Here is howto for Debian in AlternativeOS - i'll prepare Video later.
http://code.google.com/p/urukdroid/wiki/RM_AlternativeOS_Debian
Thank you!
I used your updated script with the name deb.boot.
It came up in the boot screen, but the behavior was the same.
No log output was generated in the AlternativeOS directory.
I also tried creating /mnt/card, which did not exist, and
changing the device name to /dev/block/vold/179:9 which is
what 'mount' reports for the partition mounted on /mnt/storage that
contains the image.
Here is (crappy I know - sorry ) video how bootup looks like
The video helps, thank you. When I take the same steps, my
system passes through the 'booting' screen much faster and
goes to Android.
Here is something from dmesg that may be related:
Code:
EXT4-fs: mmcblk2p1: Filesystem with huge files cannot be mounted read-write without CONFIG_LBD.
I am running Urukdroid 1.5 upgraded in the default ways from 1.0 that
was installed without incident using simple install. My SD card is a 16G PNY type 4 card,
which has been dreadfully slow and on which iobench hangs at 52%. This also
causes many aplications to trigger the 'kill or wait' dialogue (the applications
generally respond if I wait).
EDIT:
I flashed the 1.5 kernel and initramfs.
I tried the following from the post on booting Urukdroid from openAOS BootMenu:
"you may have to disable huge_file on your ext4 partition/file using tune2fs -O ^huge_file yourfile.img or /dev/yourpartition"
and I tried preceeding my device name with
/dev , /dev/block, and /dev/block/vold
Still no success, and no log output.
pengyo said:
The video helps, thank you. When I take the same steps, my
system passes through the 'booting' screen much faster and
goes to Android.
Here is something from dmesg that may be related:
Code:
EXT4-fs: mmcblk2p1: Filesystem with huge files cannot be mounted read-write without CONFIG_LBD.
Click to expand...
Click to collapse
Probably you have formatted this partition manually - with huge_files options, do it again without it.
Debian AlterntiveOS fails in Uruk 1.5
Hello at all,
my Archos device is a Archos 70 IT with 250GB hard drive, without SD card.
Have according to instructions from $aur0n repartitioned the hdd, extra partition created for the image files.
According to fdisk it is /dev/sda4, but I can not mount.
mount /dev/sda4 /mnt/card
(mount: special device /dev/sda4 does not exist)
When I mount the device with mount /dev/block/sda4 /mnt/card, I can access it.
ls -l says:
-rwxrwxrwx 1 1000 1015 4026531840 Jul 26 09:48 rootfs.img
the debian.boot is this:
*************************************************************************************************************
#!/bin/sh
#
# Script to boot alternative OS: Debian
#
# OS_Name: Debian
# OS_Desc: Debian armel
#
# Ver: 1.2 (17.08.2011) Adrian (Sauron) Siemieniak
#
set -xv
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/block/sda4"
debian_dev_mountp="/mnt/card"
# Debian image file
debian_img="rootfs.img"
debian_mountp="/AlternativeOS"
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log "Failed to mount device with debian file"
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log "Mounting system partition failed"
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
$UMOUNT $debian_dev_mountp
*************************************************************************************************************
The Folder, /mnt/card, have i created manually.
When boot to AlternativeOS - debian, debian does not start.
Android Froyo starts.
When i reboot to Developer Edition, UrukDroid starts normaly.
When i boot the Image under Standard Froyo as Developer Edition it's OK.
What is wrong?
Can anyone help me?
Sorry for my bad english.
best regards
kwalter
Check /AlternativeOS/debug.txt. It's certainly not /dev/block/xxx (this path is correct AFTER Uruk is booted, during initramfs its /dev/)
debug.txt is empty.
i have changed to: debian_dev="/dev/sda4"
The problem is the same.
kwalter said:
debug.txt is empty.
Click to expand...
Click to collapse
Make sure /AlternativeOS/debian.boot has +x for user (chmod u+x /AlternativeOS/debian.boot).
i have done chmod u+x /AlternativeOS/debian.boot
The Problem is the same.
k - i join in
tried the same with openAOS
used the script from http://code.google.com/p/urukdroid/wiki/RM_AlternativeOS_Debian (copy & paste) all I edited was rootfs.img -> openAOS.img
mkdir /mnt/card
rm /AlternativeOS/debug.txt
chmod 777 /AlternativeOS/openAOS.boot
openAOS.img is in root for SDCard -> mnt/storage/sdcard/openAOS.img
tried to boot (rescure menu -> select openAOS) -> short white bootup dialog of AlternativeOS (openAOS) -> blackscreen -> reboot (will boot stock FW) -> no debug.txt created
tried again with creating debug.txt again (with vi empty file :wq)
chmod 666 debug.txt
-> same as above nothing in debug.txt
FrEcP said:
k - i join in
mkdir /mnt/card
Click to expand...
Click to collapse
This is not required - since it's /mnt/card on initramfs (and there is this directory).
About debug.txt - I'll add more debug information and put new package.
edit: Your problem (lack of debug.txt) is because device reboot itself before it finish writing to disk... So either give "sync" after every command - or remove for a while "switch" - which cause device to reboot.
Anyway I'll modified initramfs and script to be more user friendly - I'll publish it soon...
@$auron
..... I would like to try debian ... but I don't understand at all the instructions to do it can you do a tread about this ... or maybe instructions on wiki ???
Ok,
So install this UD package
http://sauron.pourix.com/UrukDroid/UrukDroid-1.5/UrukDroid-1.5.1-kernel.tbz2
Use this boot script
Code:
#!/bin/sh
#
# Script to boot alternative OS: Debian
#
# OS_Name: Debian
# OS_Desc: Debian armel
#
# Ver: 1.2 (17.08.2011) Adrian (Sauron) Siemieniak
#
set -xv
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/mmcblk2p1"
debian_dev_mountp="/mnt/card"
# Debian image file
debian_img="rootfs.img"
debian_mountp="/AlternativeOS"
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log_msg "Failed to mount device with debian file"
sync
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log_msg "Mounting AlternativeOS partition failed"
sync
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
$UMOUNT $debian_dev_mountp
This is how debug.txt will look like (this bootup failed because rootfs.img is missing)
Code:
Fri Aug 19 07:48:21 MDT 2011
Booting up Alternative OS: debian
Bootup file is: /new-root/AlternativeOS/debian.boot
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/mmcblk2p1"
+ debian_dev=/dev/mmcblk2p1
debian_dev_mountp="/mnt/card"
+ debian_dev_mountp=/mnt/card
# Debian image file
debian_img="rootfs.img"
+ debian_img=rootfs.img
debian_mountp="/AlternativeOS"
+ debian_mountp=/AlternativeOS
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log_msg "Failed to mount device with debian file"
+ /bin/mount /dev/mmcblk2p1 /mnt/card
sync
+ sync
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log_msg "Mounting AlternativeOS partition failed"
+ /sbin/losetup /dev/loop0 /mnt/card/rootfs.img
losetup: /dev/loop0: No such file or directory
+ log_msg Mounting AlternativeOS partition failed
+ /bin/aui -c message -t AlternativeOS: Mounting AlternativeOS partition failed
sync
+ sync
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
+ /bin/mount /dev/loop0 /AlternativeOS
mount: mounting /dev/loop0 on /AlternativeOS failed: Invalid argument
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
+ [ 575 -eq 0 ]
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
+ /bin/umount /AlternativeOS
umount: can't umount /AlternativeOS: Invalid argument
$UMOUNT $debian_dev_mountp
+ /bin/umount /mnt/card
rplc790222 said:
@$auron
..... I would like to try debian ... but I don't understand at all the instructions to do it can you do a tread about this ... or maybe instructions on wiki ???
Click to expand...
Click to collapse
There IS instruction of wiki.
$aur0n said:
Ok,
So install this UD package
http://sauron.pourix.com/UrukDroid/UrukDroid-1.5/UrukDroid-1.5.1-kernel.tbz2
Use this boot script
Code:
#!/bin/sh
#
# Script to boot alternative OS: Debian
#
# OS_Name: Debian
# OS_Desc: Debian armel
#
# Ver: 1.2 (17.08.2011) Adrian (Sauron) Siemieniak
#
set -xv
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/mmcblk2p1"
debian_dev_mountp="/mnt/card"
# Debian image file
debian_img="rootfs.img"
debian_mountp="/AlternativeOS"
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log_msg "Failed to mount device with debian file"
sync
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log_msg "Mounting AlternativeOS partition failed"
sync
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
$UMOUNT $debian_dev_mountp
This is how debug.txt will look like (this bootup failed because rootfs.img is missing)
Code:
Fri Aug 19 07:48:21 MDT 2011
Booting up Alternative OS: debian
Bootup file is: /new-root/AlternativeOS/debian.boot
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/mmcblk2p1"
+ debian_dev=/dev/mmcblk2p1
debian_dev_mountp="/mnt/card"
+ debian_dev_mountp=/mnt/card
# Debian image file
debian_img="rootfs.img"
+ debian_img=rootfs.img
debian_mountp="/AlternativeOS"
+ debian_mountp=/AlternativeOS
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log_msg "Failed to mount device with debian file"
+ /bin/mount /dev/mmcblk2p1 /mnt/card
sync
+ sync
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log_msg "Mounting AlternativeOS partition failed"
+ /sbin/losetup /dev/loop0 /mnt/card/rootfs.img
losetup: /dev/loop0: No such file or directory
+ log_msg Mounting AlternativeOS partition failed
+ /bin/aui -c message -t AlternativeOS: Mounting AlternativeOS partition failed
sync
+ sync
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
+ /bin/mount /dev/loop0 /AlternativeOS
mount: mounting /dev/loop0 on /AlternativeOS failed: Invalid argument
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
+ [ 575 -eq 0 ]
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
+ /bin/umount /AlternativeOS
umount: can't umount /AlternativeOS: Invalid argument
$UMOUNT $debian_dev_mountp
+ /bin/umount /mnt/card
There IS instruction of wiki.
Click to expand...
Click to collapse
Jajajaja I missed the wiki instructions, my bad ... I will try later
I re-formatted my microsd card, with huge_file option disabled on the first partition.
The debug output shows the script runs, echoing each command without errors until
#IF mount went ok
after that block, the output differs from yours slightly:
+[ 563 -eq 0]
Then the umount commands close with another line of different output:
+/bin/umount /mnt/card
umount: can't umount /mnt/card: Device or resource busy
The output in the alternative boot menu is something to the effect
'debian failed to boot' and goes back to boot options.
pengyo said:
I re-formatted my microsd card, with huge_file option disabled on the first partition.
The debug output shows the script runs, echoing each command without errors until
#IF mount went ok
after that block, the output differs from yours slightly:
+[ 563 -eq 0]
Then the umount commands close with another line of different output:
+/bin/umount /mnt/card
umount: can't umount /mnt/card: Device or resource busy
The output in the alternative boot menu is something to the effect
'debian failed to boot' and goes back to boot options.
Click to expand...
Click to collapse
same here - full debug.txt:
Fri Aug 19 17:55:21 MDT 2011
Booting up Alternative OS: openAOS
Bootup file is: /new-root/AlternativeOS/openAOS.boot
# Device where debian image reside (storagefs on sdcard in example)
debian_dev="/dev/mmcblk2p1"
+ debian_dev=/dev/mmcblk2p1
debian_dev_mountp="/mnt/card"
+ debian_dev_mountp=/mnt/card
# Debian image file
debian_img="openAOS.img"
+ debian_img=openAOS.img
debian_mountp="/AlternativeOS"
+ debian_mountp=/AlternativeOS
# Mounting device where image file reside
$MOUNT $debian_dev $debian_dev_mountp || log_msg "Failed to mount device with debian file"
+ /bin/mount /dev/mmcblk2p1 /mnt/card
sync
+ sync
# Creating loop device
$LOSETUP /dev/loop0 $debian_dev_mountp"/"$debian_img || log_msg "Mounting AlternativeOS partition failed"
+ /sbin/losetup /dev/loop0 /mnt/card/openAOS.img
sync
+ sync
# Mounting debian rootfs disk
$MOUNT /dev/loop0 $debian_mountp
+ /bin/mount /dev/loop0 /AlternativeOS
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
+ [ 563 -eq 0 ]
# IF it fails - we can do some clean ups
$UMOUNT $debian_mountp
+ /bin/umount /AlternativeOS
$UMOUNT $debian_dev_mountp
+ /bin/umount /mnt/card
umount: can't umount /mnt/card: Device or resource busy
Thanks for showing us how to get output into the log file $auron.
It seems the problem is at the switch_root command. It gives a usage
message as if it did not recognize one of its arguments- the mount point
or the init.
FrEcP said:
same here - full debug.txt:
$MOUNT /dev/loop0 $debian_mountp
+ /bin/mount /dev/loop0 /AlternativeOS
# It mount went ok
if [ $! -eq 0 ]; then
# Switching to debian
exec /sbin/switch_root $debian_mountp /sbin/init
fi
+ [ 563 -eq 0 ]
Click to expand...
Click to collapse
This is the problem (not switch root). Mount failed. Mount returned 563 output - and should 0. That's why switch_root is even not executed.

making a nook-bootable SD card (in general) on Linux

It took me a while to figure out why verygreen's image worked, but I was not able to reproduce the result by creating my own partitions and copying his files over. Looking more closely at verygreen's image and my own, I noticed that the first partitions started at different positions. I was able to get my homebrew SD card working just by making the first partition start at the 63rd sector:
Code:
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders, total 31116288 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: 0x000e525a
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 329790 164864 e W95 FAT16 (LBA)
/dev/sdb2 329791 1312830 491520 83 Linux
/dev/sdb3 1312831 3409982 1048576 83 Linux
/dev/sdb4 3409983 31116287 13853152+ c W95 FAT32 (LBA)
How do you do this using fdisk? After you create the first partition, type 'x' for extra functionality (experts only). From there, you could then type 'b', then '1', then '63' to make your first partition start at the right place. Press 'r' to return to the main menu, and make the rest of your partitions from there. Note that this operation breaks whatever filesystem was originally on the first partition, so it would need to be reformatted. MAKE BACKUPS. Don't forget to write changes!
FatTire and nemith confirmed that the first partition needed to be special, and pointed to this informational page. It even contains a nifty script. I didn't need most of that, since tweaking the beginning-of-data worked for me every time, but give it a read anyway.
You know, I'm sure this was something very simple for the ones that knew. But I too struggled with creating a bootable sdcard from scratch. I would set up all the correct partitions with the correct flags and still nogo. Who would've thought it would be something as simple as that. Thanks for this!
-Racks
Now I can create my own "Verygreen" installer img, muah ha hah... It was that whole formatting the uSD thing with those special considerations that has been tripping me up the whole time.
This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi
DroidisLINUX said:
This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi
Click to expand...
Click to collapse
Code:
# fdisk /dev/sdb
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Print card info:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
....
Note card size in bytes. Needed later below.
Then go into "Expert mode":
Command (m for help): x
Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD/MMC card:
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 1011): 15
In this case 128MB card is used (reported as 128450560 bytes by fdisk above), thus 128450560 / 255 / 63 / 512 = 15.6 rounded down to 15 cylinders. Numbers there are 255 heads, 63 sectors, 512 bytes per sector.
Now, return to main mode and create a new partition:
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-15, default 15): 15
Mark it bootable:
Command (m for help): a
Partition number (1-4): 1
And change its type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
The result is:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
255 heads, 63 sectors/track, 15 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 15 120456 c W95 FAT32 (LBA)
Now, really write configuration to card (until here, card is not changed):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
Done! What's left is to format our partition as FAT32 to be mounted and populated:
# mkfs.vfat -F 32 /dev/sdb1
mkfs.vfat 2.11 (12 Mar 2005)
Note: before running mkfs.vfat (included in the dosfstools package in Debian) make sure /dev/sdb is not mounted.
# mount /dev/sdb1 /mnt/tmp
Note: If you use additional mkfs.vfat parameter -n you can give the card a name, e.g. for easier identification (i.e. mkfs.vfat -n omap3 -F 32 /dev/sdb1)
The SD/MMC card is now ready to be used to boot OMAP3 boards.
sfdisk
In order to format same card using sfdisk, one needs to do the following:
# sfdisk -H 255 -S 63 -C 15 /dev/sdb << EOF
> ,,b,*
> EOF
This worked for me, once I used mkcard.sh I deleted the partitions then created a new partition following these steps and now I have a 4.5 Gb boot partition and a 3.0 ext3 Angstrom partition and a 500 Mb swap partition I found that the angstrom only needed about 2.7 to 2.8 Gb or space so that was why I wanted it this way so I could still have a large sdcard when I boot normaly.
I did have to do some math as my sdcard is a 8 GB sdcard not a 128 megs but once i did the math the cyclenders came out to be 966 and then I did everything else like it said make sure to add bootable flag and edit first sector at 63 on the first partition then it works, if you have problems try to change id to option e worked (W95 FAT16 (LBA)) and use mkfs.vfat -F 16 /dev/sdb1 other wise try option c mkfs.vfat -F 32 /dev/sdb1. I got the fat 32 to work so I am happy

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 ) ??

[Guide] Resizing LG G2 partition size

Resizing LG G2 partition size​Must have: Latest TWRP Recovery, ADB experience and gdisk for arm in attached zip.
Clean /system partition (unused apps, bloatware, garbage and so on...)
Backup everything important from /sdcard.
Reboot to TWRP and connect ADB (if "ADB devices" fails, check windows "Device Management" and install "Android Sooner Single ADB Interface" for your unrecognized phone).
In TWRP backup /system and /data and download /sdcard/TWRP folder via MTP to your PC.
Now it's ADB time:
Code:
[B]# check /system used space (in Mb) and remember it, as we should cut no more than "Available" space:[/B]
adb shell "mount /system"
adb shell "df -m /system"
[B]# un-mount partitions:[/B]
adb shell "umount /system"
adb shell "umount /data"
adb shell "umount /sdcard"
adb shell "umount /cache"
[B]# unzip gdisk in your ADB folder and install it:[/B]
adb push gdisk /sbin
adb shell "chmod 0755 /sbin/gdisk"
[B]# check partitions info:[/B]
adb shell "/sbin/gdisk -l /dev/block/mmcblk0" >gpt.txt
[B]# open new gpt.txt file in your ADB folder
# now you should recalculate your new partitions (30-36) size and position (in sectors)
# partition start-sector should be even, end-sector should be odd
# to make it simplier, use formula: (new size in MB) * 2048 + 1 = (new size in sectors)[/B]
Check my examples:
Code:
default (4.4.2 firmware):
30 819200 6488063 2.7 GiB 0700 system
31 6488064 7733247 608.0 MiB 0700 cache
32 7733248 7897087 80.0 MiB 0700 tombstones
33 7897088 7929855 16.0 MiB 0700 spare
34 7929856 8028159 48.0 MiB 0700 cust
35 8028160 60948479 25.2 GiB 0700 userdata
36 60948480 61071326 60.0 MiB 0700 grow
my mod v1:
(30) 800000 3526297 1.3 GiB system
(31) 3526298 3853977 160 MiB cache
(32) 3853978 3858073 2 MiB tombstones
(33) 3858074 3862169 2 MiB spare
(34) 3862170 3866265 2 MiB cust
(35) 3866266 61067229 27.2 GiB userdata
(36) 61067230 61071326 2 MiB grow
my_mod_v2:
(30) 800000 2897153 1 GiB system
(31) 2897154 3122433 110 MiB cache
(32) --- --- deleted tombstones
(33) --- --- deleted spare
(34) 3122434 3126531 2 MiB cust
(35) 3126532 61071326 27.6 GiB userdata
(36) --- --- deleted grow
Important! It's only mine D802 4.4.2 example. You should calculate your own values, because of your /system used size, /cust size for unlock, etc.
/spare and /grow partitions unused on our phones. /tombstones is obesolete since it mounts from /data, anyway.
After all checks and calculations, let's do the magic:
Code:
[B]# run gdisk:[/B]
adb shell
cd /sbin
gdisk /dev/block/mmcblk0
[B]# no real changes applied to the phone, before "w" command.
# if you did something wrong, exit by "q" command
# you can check youreself with "p" command (partition list with virtual changes you made).
# OK, let's delete our old partitons and create them anew:[/B]
"d" command > enter partition number (for all 30-36 partitons).
"n" command > enter partition number > start > end > code (start & end = new values in sectors, code = 0700)
"c" command > enter partition number > name (system, cache, etc.)
[B]# if all seems fine, and you're pretty sure of youreself:[/B]
"w" command > "Y" answer
[B]# there is no FS on new partitions, so format them:[/B]
mke2fs -t ext4 /dev/block/mmcblk0p30
mke2fs -t ext4 /dev/block/mmcblk0p31
mke2fs -t ext4 /dev/block/mmcblk0p34
mke2fs -t ext4 /dev/block/mmcblk0p35
[B]# there is no point to format others, because they have no fs by default.
# if using kernel with F2FS support (like Dorimanx), you can format some of them as F2FS:[/B]
mkfs.f2fs /dev/block/mmcblk0p35
[B]# to make TWRP realise, horrors we just did - reboot it:[/B]
reboot recovery
[B]# after reboot, we can optimize /userdata a bit (ext4 only), with this:[/B]
adb shell "tune2fs -m 0 /dev/block/platform/msm_sdcc.1/by-name/userdata"
[B]# bring backups from PC to /sdcard via MTP and restore them, as usual
# now you can reboot to your system with custom-sized partitions!
# P.S. If you notice your /sdcard permissions glith a bit after all this - flash "sdcard Fix Permissions script" from [URL="http://forum.xda-developers.com/showthread.php?t=2239421"]this[/URL] thread.[/B]
Good luck.
Awesome :good: this guide will help 16GB user like me to increase data/sdcard partition
Too bad I don't have pc to play around with....
so, stock, user-usable fresh after format on KK4.4 we have 24GB on the /sdcard part. Would we want to use this to go smaller? Would there be a benefit to that? Or would I want to use it to go larger, shrinking my /sdcard
I know it can go both ways, but which are people more interested in here?
rancur3p1c said:
I know it can go both ways, but which are people more interested in here?
Click to expand...
Click to collapse
Who knows? It's not that hard, it takes 5 minutes, it gets you + 1-3 Gib on the phone (without SD-Card support), and it's safe - coz we don't touch bootloader or recovery partitions... It's worth it.
THIS is just pure awesome
I've followed the guide and successfully added almost 2gb to userdata on my 16gb d802
This is my gpt for now
30 791568 4158721 1.6 GiB 0700 system
31 4158722 4306179 72.0 MiB 0700 cache
34 4306180 4310277 2.0 MiB 0700 cust
35 4310278 30777310 12.6 GiB 0700 userdata
And this is my aim, if i have time to do it again
30 791568 3937297 1.5 GiB 0700 system
31 3937298 3961875 12.0 MiB 0700 cache
34 3961876 3965973 2.0 MiB 0700 cust
35 3965974 30777310 12.7 GiB 0700 userdata
Also, i've notice this in the gpt.txt file
Total free space is 230360 sectors (112.5 MiB)
So can we get even more from our phone?
Hello everybody
first of all I ll thank you for your guide Resizing LG G2 partition size.
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
My partition table looks like:
Code:
30 819200 3686401 1.4 GiB 0700 system
31 3686402 4014083 160.0 MiB 0700 cache
34 4014084 4034565 10.0 MiB 0700 cust
35 4034566 30777310 12.8 GiB 0700 userdata
If someone have any idea how I can solve this problem?
Thanks
Chris
I am thinking to try this tool, but I would like to know if flashing kdz will work in case I screw things up, or am I risking to permanently brick the phone?
Okay, going back to stock partitions will fix my problem and my system partition is again 2.7 GB
With the customised partitions i was unable to install neither Resurrection Remix Rom nor Google Edition 1.5. Both return an error in twrp.
Backfisch said:
Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
Click to expand...
Click to collapse
I have the same problem. Did you fix it by any chance?
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Backfisch said:
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
Click to expand...
Click to collapse
Okay, the fix is that you have to restore TWRP backup, in my case CM13 booted all good. But now I have a different problem, the MTP connection is really unstable, disconnects and reconnects for no reason. Same problem using twrp mtp or cm mtp. Tried two different cables, two different pc, and resized the partitions twice using different values. Still no luck. Anyone had any similar experience?
EDIT: Seems my charging port is failing. Many cables have hard time being stable, but some of them work better.
Backfisch said:
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Click to expand...
Click to collapse
Back when I tried to resize the /system partition, all non-lg rom doesnt install because of that error, and they are the ones that has the most potential of freeing some space
you can only get some space from /cache and other partitions without getting errors
I have gained 2 Gb extra space on the internal memory, and it works great so far. The only problem is that flashing roms from twrp returns the error /system can not be mounted, and you have to install the rom by restoring twrp backups.
Am I right in thinking that you cant install an rom update with modified partitions by flashing it in twrp?
If restoring my backup is the only way to install my rom, I will delete some music and pictures on the userdata partition...
You can install roms with "system" folder and files in it, on modified partitions (if you have enough space in /system, of course).
But you won't be able to install CyanogenMod-based roms with partition image in them (system.img, system.bin, etc.)
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
SantoSubito said:
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
Click to expand...
Click to collapse
Did you fix it yet? Does download mode work? Why didn't work flashing kdz in the first place?
Yes it does. After flashing kdz phone enters recovery and I have list of errors. And when i tried to flash tot i have error something with laf partition and gpt. Yesterday i tried to recover it from 9008 but I'm also getting error :c
SantoSubito said:
And when i tried to flash tot i have error something with laf partition and gpt.
Click to expand...
Click to collapse
Try to flash TOT-firmware with modded dll (bypass gpt-error). One of this should do the trick.
Yeah it worked. But not in 100%. When its 94% my phone reboots and LG Tool shows:
...
CACHE
CACHE
CUST
Wiating for the device 120s
then device reboots and get bootloop
BoardDiag have this wierd dload error and also i cant do nothing with this tool

Categories

Resources