[GUIDE] Repartition your gpt partitioned device after custom rom install(Huawei Y6) - Android General

This guide was written for the Huawei y6 with a gpt partition table, mounts that use partition names not numbers and the userdata partition is the last one on disk however with a little adaption this should work for most gpt devices.
If you are unsure if your system uses partition names for the mount system look in /fstab."hardware" to see if your devices are labelled in the following manner. "/dev/block/bootdevice/by-name/system".
If the fstab file does not exist all is not lost look in your root directory at the .rc files for the command mounting system.
If you are unsure ask in the thread before doing anything. Better to ask than be stuck with a brick.
This guide covers modification to only system and userdata partitions but if you use great care the basics covered here will allow for modification to other partitions as long as you understand the risk and know that backups are your friend.
If you are unable to follow instructions and end up with a bricked device that is your own fault and attempts to blame me will be laughed at.
I obtained the attached parted binary from here
So you have flashed a custom ROM and without all the OEM bloatware you now have some unused free space in your system partition just sitting there gathering dust.
You are stuck with this space... Wrong.
You can repartition your device with a little paitence, time and work.
Read along if you are curious about how to get the space you deserve.
Prerequisites:
Free space (Duh).
The ability to follow instructions and to read ALL steps before you start so you know what your plan is.
An unlocked bootloader which you already have if you flashed a custom ROM.
A custom recovery (twrp preferred).
Parted binary (see attachment at the bottom of this post).
A computer with adb installed and working (there are many guides out there if you don't have it, Google is your friend).
A calculator (well I'm sure your computer has one but just so you know).
Some knowledge using terminal commands.
Risk of Bricking your device:
Low if you backup and can double check typing and calulations.
High if you can't do one of the above.
Because parted does not allow resizing of ext4 partitions you must delete partitions you want to change then recreate them.
All steps must be performed while in recovery because you are going to have to unmount any partition before you can change it.
Step 1:
Boot into recovery and make a backup. You MUST do this otherwise you will have nothing to restore.
Step 2:
Plug your device into your computer.
Copy the parted binary into your working directory on your PC.
Open your Command Prompt (Windows) or Terminal (Linux) and navigate to where adb is installed and you also put parted, or if you have adb in your PATH just go to where parted is.
Run
Code:
~ # adb devices
to ensure your device is present.
Run
Code:
~ # adb root
to get root priviliges.
Run
Code:
~ # adb push parted /sbin/parted
/sbin is in your devices PATH so you don't have to worry about typing /parted.
Run
Code:
~ # adb shell
Run
Code:
~ # chmod 755 /sbin/parted
If you get an error about a read only file system run
Code:
mount -o remount,rw /
then try again.
Step 3: Now you need to do some homework to find your sector size, sector count and how much free space you have available.
DO NOT shrink your filesystem to smaller than you need to operate. I always add at LEAST 50 mb to the used space however I recommend you think for the future, are you planning on restoring to stock?, are you planning on flashing OpenGAPPS?, are you planning on moving third party apps into the system?, are you planning on adding media or custom boot animations to the system?
So in the case below I would not make the partition any smaller than 800 MB.
Code:
~ # df
Filesystem Size Used Free Blksize
/system 1.2G 748.5M 441.8M 4096
/data 5.2G 3.5G 1.6G 4096
/cache 147.2M 4.7M 142.5M 4096
Now issue the following command to get your disks sector size in bytes remember to note this down.
Code:
~ # blockdev --getss /dev/block/mmcblk0
512
Time to use parted.
Issue the following commands to get some info on your current partitions.
"unit s" tells parted to show sectors instead of blocks, bytes etc.
Code:
~ # parted /dev/block/mmcblk0
(parted) unit s
(parted) print
Number Start End Size File system Name Flags
22 876562s 1191132s 314571s ext4 cache
23 1191133s 3990839s 2799707s ext4 system
24 3990840s 15269854s 11279015s ext4 userdata
Remember to not the partition number as you will need it later.
Remember to note your partition name with exact case, if you changed "system" to "System" you will have problems.
Also note the start sector of your system partition for the later steps.
Also note the end sector number for your userdata partition for the later steps.
Now get your calulator ready.
Some things to keep in mind here are that the number of sectors times sector size is the size of your partition in bytes and your starting sector must be 1 after the end of the previous partition.
So the following equation will give you the numbers you need.
Desired size in MB * 1024 * 1024 / Sector Size = Number of sectors
Starting sector + Number of sectors - 1 = Last Sector
If you want a 1.1 Gb partition, you have 512 byte sectors and the starting sector is 1191133 you would then use the following equation.
1100 * 1024 * 1024 / 512 = 2252800
1191133 + 2252800 - 1 = 3443932
Step 4:
Now using the info you have gathered you can change your partitions.
So I would issue the following commands to delete, create and name the system partition with the size I want.
Code:
(parted) rm 23
(parted) mkpart 23 ext4 1191133 3443932
(parted) name 23 system
Now to resize the data partition.
You need to start with the first available sector after the end of system and end with the last available sector noted earlier.
Code:
(parted) rm 24
(parted) mkpart 24 ext4 3443933 15269854
(parted) name 24 userdata
Now that your partitions are all done you can exit parted with the following.
Code:
(parted) quit
Step 5:
Now restore the backup you made earlier.
If you get an error restoring which usually only happens if you have altered partition numbers just reboot back into recovery and restore then so the kernel gets to update its own info.
Reboot.
Congratulations you now have repartitioned your device.
Don't forget to thank this post if you are grateful.

Is there anything diferent to do about moderm mmcblkop14(/firmware)? I want to reduce it to 100 mb but i noticed its blocksize it's different from the others (others =4096, firmware=16384). I saw in your pictures you reduce it, so i will try it to do that. I have a nandroid so i hope this try works.

OK, i should probably been the first idiot to bricked his phone by reading a tutorial.
I need some help. I was trying to make this extra space and i have a few problems during the process.
First of all, in my case i have a partition 23 called cust, exactly the same in size with the cache. So i started with the cache calculating and then the other 3( 23 cust, 24 system, 25 userdata). For that moment i already made my nandroid, buy for some stupid reason I saved to my pc.
My problems came when i began with step 4. When i tried to put the cache it told me that it can't do it because it was in use. So i twrp y put on mount and desmounted that partition and then i could keep going. Same thing happened with Data partition, i did the same.
Finally, i did it all the tutorial, just needed to restore as it said in step 5 because i didn't have it in my phone. So i tried with adb push but nothing and i couldn't mount again those partition with twrp. Then, in a desperate move, i tried to reflash my cm rom, so i did that. And later, it bootloop with te huawei logo and i can´t flash a rom o restore my nandroid. It doesn't read a sdcard.
And now, when i see the script in twrp (sorry i don't know how is the name, i talking about the center botton in twrp) it appears in red "unable to mont '/data', '/system', '/cache'.
I don't know what to do, really, i need a hand.

beatLeo said:
OK, i should probably been the first idiot to bricked his phone by reading a tutorial.
I need some help. I was trying to make this extra space and i have a few problems during the process.
First of all, in my case i have a partition 23 called cust, exactly the same in size with the cache. So i started with the cache calculating and then the other 3( 23 cust, 24 system, 25 userdata). For that moment i already made my nandroid, buy for some stupid reason I saved to my pc.
My problems came when i began with step 4. When i tried to put the cache it told me that it can't do it because it was in use. So i twrp y put on mount and desmounted that partition and then i could keep going. Same thing happened with Data partition, i did the same.
Finally, i did it all the tutorial, just needed to restore as it said in step 5 because i didn't have it in my phone. So i tried with adb push but nothing and i couldn't mount again those partition with twrp. Then, in a desperate move, i tried to reflash my cm rom, so i did that. And later, it bootloop with te huawei logo and i can�´t flash a rom o restore my nandroid. It doesn't read a sdcard.
And now, when i see the script in twrp (sorry i don't know how is the name, i talking about the center botton in twrp) it appears in red "unable to mont '/data', '/system', '/cache'.
I don't know what to do, really, i need a hand.
Click to expand...
Click to collapse
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
Code:
ls /dev/block/bootdevice/by-name/
and let me know if it shows your cache, userdata and system.

DestructoSphere said:
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
Code:
ls /dev/block/bootdevice/by-name/
and let me know if it shows your cache, userdata and system.
Click to expand...
Click to collapse
- Yes, my device is Y6 (SCL-L03).
- Seems that i don't have access to adb, because in cmd show me "offline" device.
-Yes, i fineshed with that, but couldn't do the restore of backup.
- I did all step 4.
- Yes, i'm using twrp.
I put the code with twrp... and here it says not found.
Any ideas? I hope you could help me.

beatLeo said:
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
- Yes, my device is Y6 (SCL-L03).
- Seems that i don't have access to adb, because in cmd show me "offline" device.
-Yes, i fineshed with that, but couldn't do the restore of backup.
- I did all step 4.
- Yes, i'm using twrp.
I put the code with twrp... and here it says not found.
Any ideas? I hope you could help me.
Click to expand...
Click to collapse
You need to put a space between ls and the /

DestructoSphere said:
You need to put a space between ls and the /
Click to expand...
Click to collapse
ups, ok, i did that and i see all the partitions including cache, cust, system and userdata. Please, what is next?

beatLeo said:
ups, ok, i did that and i see all the partitions including cache, cust, system and userdata. Please, what is next?
Click to expand...
Click to collapse
Ok I suspect maybe the filesystems never got created.
Can you run
Code:
df
this will show you the currently mounted partitions free space.
Output will look something like this
Code:
Filesystem Size Used Free Blksize
/dev 442.6M 60.0K 442.5M 4096
/system 1.2G 948.5M 241.8M 4096
/data 5.2G 2.8G 2.4G 4096
/cache 147.2M 176.0K 147.0M 4096
/persist 3.9M 776.0K 3.1M 4096
/firmware 99.8M 46.8M 52.9M 2048
If you dont see data or cache they never got mounted at twrp start, system is not mounted by default.
Then if data is not listed try
Code:
mount -t ext4 /dev/block/bootdevice/by-name/userdata /data
Remember to have spaces between arguments.
Or try system by replacing "userdata" with "system" and "/data" with "/system"
If you get an error trying to mount please do the following referring to the attached screenshots.
In twrp, go to "wipe", "advanced wipe". Then select one of the partitions and select "repair or change filesystem".
This should give you info about the partition.
If you wish to reformat it select "change filesystem" then select "ext4" and swipe to confirm.
Now retry the mount command and hopefully it will succeed.
Do this for each partition then retry your backup/flash.
Hopefully this works, good luck.

Thanks for your help. At first i couldn't see cache or data partition. I did what you told me, and i made cache to appears with df command. System too. But i couldn't made the same with the userdata partition. I tried to repair but it didn't work.
Is there another way to remount that partition?
A question apart: what was that "cust" partiton i've got and you didn't in your images posted in cm12.1 post? Because i recalculated it too.

beatLeo said:
Thanks for your help. At first i couldn't see cache or data partition. I did what you told me, and i made cache to appears with df command. System too. But i couldn't made the same with the userdata partition. I tried to repair but it didn't work.
Is there another way to remount that partition?
A question apart: what was that "cust" partiton i've got and you didn't in your images posted in cm12.1 post? Because i recalculated it too.
Click to expand...
Click to collapse
Hi,
Does twrp show the userdatas partition filesystem type? Like in my previous screenshot cache is shown as ext4.
If not can you try change filesystem instead of the repair option and choose ext4.
I removed my cust partition altogether as I had no use for it.

DestructoSphere said:
Hi,
Does twrp show the userdatas partition filesystem type? Like in my previous screenshot cache is shown as ext4.
If not can you try change filesystem instead of the repair option and choose ext4.
I removed my cust partition altogether as I had no use for it.
Click to expand...
Click to collapse
Yes, it shows current file system: ext4. I tried repair and change file system but nothing. When i'm trying to use "mount -t ext4 /dev/..." it says "failed: invalid argument"
What else could i do?
I really appeciate your help man.
P.S: Sorry, i don't know why the screenshot looks not vertical.

beatLeo said:
Yes, it shows current file system: ext4. I tried repair and change file system but nothing. When i'm trying to use "mount -t ext4 /dev/..." it says "failed: invalid argument"
What else could i do?
I really appeciate your help man.
P.S: Sorry, i don't know why the screenshot looks not vertical.
Click to expand...
Click to collapse
Ok for some reason filesystem seems to have issues.
Can you please try
Code:
mkfs.ext2 -j /dev/block/bootdevice/by-name/userdata
to manually format it?
Remember spaces before and after -j option.

DestructoSphere said:
Ok for some reason filesystem seems to have issues.
Can you please try
Code:
mkfs.ext2 -j /dev/block/bootdevice/by-name/userdata
to manually format it?
Remember spaces before and after -j option.
Click to expand...
Click to collapse
It says mkfs.ext2: lseek: Value too large for define data type

beatLeo said:
Ok for some reason filesystem seems to have issues.
Can you please try
It says mkfs.ext2: lseek: Value too large for define data type
Click to expand...
Click to collapse
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
Code:
blockdev --getsize64 /dev/block/bootdevice/by-name/userdata

DestructoSphere said:
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
Code:
blockdev --getsize64 /dev/block/bootdevice/by-name/userdata
Click to expand...
Click to collapse
it says 5465161216

beatLeo said:
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
it says 5465161216
Click to expand...
Click to collapse
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Code:
parted
unit s
print free

DestructoSphere said:
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Code:
parted
unit s
print free
Click to expand...
Click to collapse
Hi DestructoSphere,
tried to do that, but remember i can't get to adb so i can't find a way to paste the parted file into de sbin. Any ideas about that?

beatLeo said:
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Hi DestructoSphere,
tried to do that, but remember i can't get to adb so i can't find a way to paste the parted file into de sbin. Any ideas about that?
Click to expand...
Click to collapse
In twrp can you mount mtp or usb storage and copy it to sdcard then twrp filemanager to copy to sbin?

Ok, i tried with a sdcard, but i couldn't either. It didn't recognize my sdcard. And i don't have an otg's usb.
But in twrp's cmd showed "mtp enabled". Could this means that i have to mounted the sd partition? If that is a yes, could you please write me the code ?

beatLeo said:
Ok, i tried with a sdcard, but i couldn't either. It didn't recognize my sdcard. And i don't have an otg's usb.
But in twrp's cmd showed "mtp enabled". Could this means that i have to mounted the sd partition? If that is a yes, could you please write me the code ?
Click to expand...
Click to collapse
Hi DestructoSphere, i finally resolve this. It was a lot simplier than you ever thought. I tried changing to ext2 my data partion, and then change it again to ext4 and that's how it works again.
Take a look into my partitions. But i still want to reduce to 100mb the modem partition.

Related

[REF] manual partition of sdcard w/parted,goto ext3/4 from adb. no liveCD req'd

i needed a way to format my sdcard & install swap capable rom with no card reader...grrr...my gray hair is your gain!
READ THIS FIRST: i wrote a script that automagically partitions the sdcard. get it here.
if you still want to partition manually, read on.
i did this with a BLANK 8gb card and a fresh rom install, so i had no data to lose..be careful. i take no responsibility for what happens to your phone, sdcard, data, sanity, etc if you follow these instructions. remember to backup your sdcard to your pc before you begin.
technically, you don't need adb for this, as you can partition your card in the recovery console on the g1(...not the terminal app) using the commands in this post. however, once you wipe your sdcard, you may want some way of getting a new rom onto the phone. ;p
these instructions apply to both, the windows command prompt and the mac terminal.
just about any size and/or class of sdcard will work, but you will want to use a class 6 cause it's wicked fast. 16gb transcend sdcards seem to be giving some people trouble and throwing "ERROR: input/output error during write on /dev/block/mmcblk0" when trying to partition. use them at your own peril.
the example in this thread is for MY sdcard...YOUR sdcard will be different and the partition sizes may vary. apply ur information(sdcard size, partition size) when appropriate. following the instructions in this post will erase ALL DATA on the sdcard before creating new partitions.
read the ENTIRE post VERY carefully BEFORE proceeding or asking questions...
#####
note #1: all typed commands are in bold. adb/console commands in black. windows prompt commands in green.
note #2: if all else fails...remove all partitions and create new. this seems to solve 99.9% of non-hardware related problems.
note #3: if note #2 fails...try 'mklabel msdos'. see below for more info.
note to ext3/ext4 fs users: parted does NOT support CREATING ext3/ext4 partitions..you MUST create with ext2 and upgrade. also, parted CAN RESIZE ext3 partitions, but with restrictions. check out the table on the features page, of their website. i will NOT go into resizing partitions in this post as there are many variations...
#####
need to backup your ext partition?
note: these backup commands must be run while phone is booted, not recovery.
to backup your ext partition to your current directory: adb pull /system/sd/ %CD%\sdbackup
to restore back to sdcard: adb push %CD%\sdbackup /system/sd
#####
having issues? please post the following when asking for help:
output from the following commands
parted /dev/block/mmcblk0 print
parted /dev/block/mmcblk0 check 1, if any.
parted /dev/block/mmcblk0 check 2, if any.
parted /dev/block/mmcblk0 check 3, if any.
what rom are you using?
what brand/size/class sdcard?
can you see fat32 partition on the phone? ie. through andExplorer or similar..
#####
materials:
g1 with cm-recovery-1.4
sdcard <--class 6 recommended(adata makes good ones...they max out the g1 hw in terms of speed)
rooted rom with ext3/4 support & swap capability <--recommend CyanogenMod
adb
fingas(or toes if you're this guy)​
part i - prepare the sdcard:
boot your g1 into recovery (using home + power)
drop to console (alt + x)
open windows command prompt and enter:
adb shell
now at the # prompt enter:
parted /dev/block/mmcblk0
you are now in parted...hopefully. if not, check your typing, start over, do more research, or give up.
to find out the size of your sdcard & the partitions that it contains, enter:
print
you may receive a message from the program:
Code:
"No Implementation: Partition 1 isn't aligned to cylinder boundaries. This is
still unsupported."
the error says it all.. ;P
not sure what this means exactly(besides our partitions being out of alignment), but it is not good for our purposes.
also, if your "Partition Table" is reported as being "loop", i suggest repairing with the following procedure as well since it seems to be causing some problems too.
to fix, type:
mklabel msdos
it may give you some guff about:
Code:
Warning: The existing disk label on /dev/block/mmcblk0 will be destroyed and all data on
this disk will be lost. Do you want to continue?
parted: invalid token: msdos
answer y to the 'yes/no'..
and then:
Code:
New disk label type?
confirm with: msdos
re-enter: print​
you should get something like:
Code:
print
print
Model: Unknown (unknown)
Disk /dev/block/mmcblk0: 7969MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 7469MB 7469MB primary fat32 lba
2 7469MB 7969MB 500MB primary ext2
or, if your sdcard is new/empty you'll get:
Code:
print
print
Model: Unknown (unknown)
Disk /dev/block/mmcblk0: 7969MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
if no numbered partitions come up, move onto next step. if not, delete ALL partitions that you see with the rm command. it has the format: rm <partition number>.
in this case:
rm 1
rm 2
the fourth line in the 'print' command output shows you the total size of sdcard in MB(or GB if you card is large)..mine says: Disk /dev/block/mmcblk0: 7969MB
use this number(XXXXMB) and do some simple math to get the size of your partitions.
7969MB - 32MB linux-swap = 7937MB
7937MB - 500MB ext2 = 7437MB fat32​
32MB seems to be alright size for swap, though it can be lower depending on your sdcard size.
500 MB is a good round number for the ext2 partition...no need for more.
that leaves us with 7437MB for fat32 storage.​
part ii - create partitions:
for a2sd & swap to work properly, partitions MUST be created in this order: fat32, ext2, linux-swap
the command to create partitions is mkpartfs...command format is:
mkpartfs <partition type> <fs type> <start> <end>
note#1: the <start>/<end> numbers in the following section correspond to the italicized numbers above. your partition information will most likely be different.
note#2: by default parted assumes ur using MB as the units in commands. say you have a card that is LARGE(like 16GB) and want a partition of 12GB...all you do is use the proper units(ie. mkpartfs primary fat32 0 12GB) and parted will oblige. you can use decimals as well...if you want a similar setup to my calculations above, you would have a fat32 partition of 15.4GB(ie. mkpartfs primary fat32 0 15.4GB), 500MB ext2, and 32MB swap
now we create the partitions:
mkpartfs primary fat32 0 7437
mkpartfs primary ext2 7437 7937
mkpartfs primary linux-swap 7937 7969
to check out our handy work, enter:
print
output should be similar to:
Code:
print
print
Model: Unknown (unknown)
Disk /dev/block/mmcblk0: 7969MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 7437MB 7437MB primary fat32 lba
2 7437MB 7937MB 500MB primary ext2
3 7937MB 7969MB 32.2MB primary linux-swap(v1)
to exit parted type:
quit
after quitting you may receive a message containing:
Code:
Information: You may need to update /etc/fstab.
no need to worry. fyi, fstab is a file that keeps track of disks & partitions in *nix. more info on fstab can be found here.​
part iii - convert ext2 to ext3/ext4:
parted will not create ext3/ext4 partitions...see beginning of post
to upgrade, enter:
upgrade_fs
you now have journaling(aka ext3)! if ext3 is all you want, skip next two commands.
you want ext4?
enter:
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
e2fsck -fpDC0 /dev/block/mmcblk0p2​
part iv - copy rom to sdcard and install, enable swap:
open another win cmd prompt, enter:
adb shell mount /sdcard
adb push /update-path/update.zip /sdcard
exit
in original cmd prompt, enter:
reboot recovery
after reboot:
wipe data (alt + w) <--this one is optional, but i like fresh installs
install rom (alt + s)
to enable swap, see this page.
note: you do not need to enable swap if your rom does it automagically.​
#####
all told, i end up with:
~7.5GB fat32
~500MB ext4
~32MB swap
cyanogen-v3.6.8.1 running faster than ever!
hope this wasn't too painful.
btw, you could use a live cd, but i think this is easier and maybe a little more fun!
very nice guide! I will have to test it out later on! Thanks! .
does this damage the sd card in anyway? i was running jac hero with swapper and it killed my sd card...but nice tut..might try it
wow... I never knew you were allowed to partition straight from terminal or I wouldn't have wasted a CD on g-parted... =/ nice guide, next time I need to partition, I'll use this method.
jay22are, partitioning the card will not damage it, but if you use it for swap you will always run the risk of corrupting your card, however, I read that someone calculated that it would still take 2yrs for your card to start having problems using swapper. So good luck.
Is their a noticeable increase in speed when running a non hero rom with swapper?
marixsmith said:
Is their a noticeable increase in speed when running a non hero rom with swapper?
Click to expand...
Click to collapse
extremely noticeable. apps run & transition much smoother than without the swap partition. although, i must say that most of the speed & stability in my setup is cyanogen's rom...it's awesome.
now i have a question...
does anyone know if there are speed/reliability differences between using the swapfile(like with the swapper app) and the swap partition? i did the partition b/c that's how i've always configured linux installs and it let's me mount the sdcard w/o issues.
when i'm trying to do the commands I run into this:
(parted) mkpartfs fat32 0 7584
mkpartfs fat32 0 7584
mkpartfs fat32 0 7584
parted: invalid token: fat32
Partition type? primary/extended?
doesn't seem like the guide covers all of the steps.
same problem as engaged...
Was wondering when someone would write this guide!
h.nocturna said:
wow... I never knew you were allowed to partition straight from terminal or I wouldn't have wasted a CD on g-parted... =/ nice guide, next time I need to partition, I'll use this method.
Click to expand...
Click to collapse
I just built and included Parted on the new recovery image (1.3.1). I was just waiting for someone to do a writeup about it because I'm lazy
engagedtosmile said:
when i'm trying to do the commands I run into this:
(parted) mkpartfs fat32 0 7584
mkpartfs fat32 0 7584
mkpartfs fat32 0 7584
parted: invalid token: fat32
Partition type? primary/extended?
doesn't seem like the guide covers all of the steps.
Click to expand...
Click to collapse
Should be "mkpartfs primary fat32 0 7584".
Parted can also resize your existing partitions without erasing data.
cyanogen said:
Parted can also resize your existing partitions without erasing data.
Click to expand...
Click to collapse
I'm gonna try when I get home always wanted to resize my partition without apps and data being loss
cyanogen said:
Parted can also resize your existing partitions without erasing data.
Click to expand...
Click to collapse
I'm gonna try when I get home always wanted to resize my partition without apps and data being loss. By the way great job with the roms, recovery's, and all the rest of the hard work you guys do. You guys are genious
cyanogen said:
Was wondering when someone would write this guide!
I just built and included Parted on the new recovery image (1.3.1). I was just waiting for someone to do a writeup about it because I'm lazy
Should be "mkpartfs primary fat32 0 7584".
Parted can also resize your existing partitions without erasing data.
Click to expand...
Click to collapse
@engage & others: fixed my mistake in original post
thanks cyanogen!
guess that's what i get for typing too fast... ;p
what am i doing wrong?
Im using a 2gb card.
following the guide after i use the print command it tells me my card is 2033MB in size
and it lists my start point at 32.3kB
i typed: mkpartfs primary fat32 32.3kB 1458MB
it states it cant make the partition and the closest it can do is 31.7kb to 31.7.
is it something im doing?
CC CEO said:
Im using a 2gb card.
following the guide after i use the print command it tells me my card is 2033MB in size
and it lists my start point at 32.3kB
i typed: mkpartfs primary fat32 32.3kB 1458MB
it states it cant make the partition and the closest it can do is 31.7kb to 31.7.
is it something im doing?
Click to expand...
Click to collapse
i believe the reason it is not exactly 0 is because it needs room for the partition information. mine was similar...i believe 31.9kb.
you don't need to use the 'kb' / 'mb'...i just use whole numbers and the prg figures out the hard stuff..
hmm...maybe remove all partitions (using the rm command) and start from scratch.
check out this site
can you paste/link to the console output to the forum?
What about ext4
I got brave and decided to "resize" my ext4 partition down 32MB to create a swap space.
First, I backed up everything using windoze after mounting.
But then it occured to me perhaps I should do a complete backup of my sd card first, including my ext4. But HOW?
Also, cyanogen said parted will resize with no data loss, so I assume you just use the "resize part# start stop" ??
Anyway, when I did my print command, it listed my FAT32 and an ext3. When I try and do anything to ext3, I get a "Error: File system has an incompatible feature enabled" message. I am guessing this is the ext4 stuff?
Will just sit tight for now, before I blow my entire SD card and have to start from scratch till someone can tell me safest way to backup sd card to pc completely and what to do about the ext4 errors.
Thanks in advance for the help!
very cool, I feel like such a dork doing it this way and it feels good! When i put in my command for the partition I got this error:
Warning: You requested a partition from 0.00B to 7216MB.
The closest location we can manage is 512B to 31.7kB. Is this still acceptable
to you?
Click to expand...
Click to collapse
not sure why I think its because the disk already had partitions. I couldn't remove them because parted said the disc was mounted. So I still couldn't avoid booting to the live cd and reformating though :*(
edit: actually rebooting the phone allowed me to use the rm command and remove my partitions and follow your instructions. Worked great thank you! this is going to save me loads of hassle in the future
edit2: spoke too soon when I run upgrade_fs I get this message
e2fsck 1.41.6 (30-May-2009)
/sbin/e2fsck: Superblock invalid, trying backup blocks...
/sbin/e2fsck: Bad magic number in super-block while trying to open /dev/block/mm
cblk0p2
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
Click to expand...
Click to collapse
so i use the repair ext filesystems on the recovery image and it says
Checking filesystems. Error checking filesystem! Run e2fsck manually from console.
Click to expand...
Click to collapse
any help?
edit3: deleted the partitions and did it again, worked this time
This is exactly what i was looking for, thank you so much for this!
51dusty said:
extremely noticeable. apps run & transition much smoother than without the swap partition. although, i must say that most of the speed & stability in my setup is cyanogen's rom...it's awesome.
now i have a question...
does anyone know if there are speed/reliability differences between using the swapfile(like with the swapper app) and the swap partition? i did the partition b/c that's how i've always configured linux installs and it let's me mount the sdcard w/o issues.
Click to expand...
Click to collapse
first, IMHO and research, the swap partition does nothing to cyanogen's roms because of his magic touch, however, it does work wonders with the browser, and with all other builds besides cyan's
second, The swap file is placed on your fat32 partition, when you mount your sd card to your pc, the swap file disappears and your rom crashes...
stick with a linux-swap partition. you shouldn't go over 32mb tho, it gets glitchy after that.
yes you DO HAVE remove pre-existing partitions with rm command... obviously if you don't want to resize them.
genez
jklong03 said:
I got brave and decided to "resize" my ext4 partition down 32MB to create a swap space.
First, I backed up everything using windoze after mounting.
But then it occured to me perhaps I should do a complete backup of my sd card first, including my ext4. But HOW?
Also, cyanogen said parted will resize with no data loss, so I assume you just use the "resize part# start stop" ??
Anyway, when I did my print command, it listed my FAT32 and an ext3. When I try and do anything to ext3, I get a "Error: File system has an incompatible feature enabled" message. I am guessing this is the ext4 stuff?
Will just sit tight for now, before I blow my entire SD card and have to start from scratch till someone can tell me safest way to backup sd card to pc completely and what to do about the ext4 errors.
Thanks in advance for the help!
Click to expand...
Click to collapse
to backup ext partition just cp /system/sd it has the apps dirs and dalvik-cache
this ver of parted does not handle ext3/4...that's why you have to upgrade after partitioning. as far as resizing goes...i would imagine it can't do that to ext3/4 either.
maybe cyanogen can provide complete explanation of ext3/4 support...?
my advice would be to delete all and start fresh..i'm not a huge fan of resizing partitions...it seems to let gremlins into the fs. ;p

[REF] Fix internal SD partitions

DISCLOSURE: Not responsible for you being retarded and breaking what doesn't need fixed.
DISCLOSURE 2: Do not use this on the O2x as it has a slightly different partition table.
Here is my step by step for repairing the internalsd Partitions... I don't think I've forgotten anything in this. If anyone knows how to write this into a .zip for flash via CWR it would be great. Credit goes to TeamWhiskey for helping me out when I screwed my partition table up...
WARNING: This can destory your internalSD card partitions. If it's not broke don't fix it!
ALL ENTRIES ARE IN RED
I am not responsible for any damage you do to your phone.
I did this same thing to my phone... I was still able to get into recovery though. You can repair the internal partitions through ADB if you can still get into recovery.
Steps to recreate partitions.
Boot into recovery
from your PC open cmd prompt
change to your ADB directory
run adb shell
mkfs /dev/block/mmcblk0
fdisk -H 1 /dev/block/mmcblk0
if the above fails try fdisk -l /dev/block/mmcblk0
then fdisk -H 1 /dev/block/mmcblk0
once in the fdisk of ../mmcblk0 you might as well delete all the partitions if you believe that they are corrupted
d
1
repeat for partition 2-8
one all of your partitions are gone you now have a blank internal SD and will need to execute the following to restore all the proper partition sizes
Partition 1
n
p
1
First Cylinder start 129
First Cylinder stop 55168
We will repeat this for partitions 2 and 3
Partition 2
n
p
2
Start 55169
Stop 63360
Partition 3
n
p
3
Start 63361
Stop 63616
On to partition 4 which will be extended (this is the last partion you will choose primary or extended)
Partition 4
n
e
4
Start 63617
Stop 975424
Now onto partition 4-8 which are automatically selected as logicall partions (no option is given)
Partition 5
n
Start 63681
Stop 64704
Partition 6
n
Start 64769
Stop 65088
Partition 7
n
Start 65153
Stop 261760
Partition 8
n
Start 261825
Stop 975424
Once you have done this the partitions are ready to be written to the internalSD
I would recommend choosing the command p to verify that all of your start and stop blocks are correct.
From this point you have the option to either quit without saving changes "q" or to write the partition table itself "w". Once you are sure that you have entered all of your partitions correctly you can choose the command w
At this point you have recreated all the partitions on your InternalSD card. If you have a nandroid backup at this point you should be able to restore it without a problem once you copy it over to the internal or external (depending on which CWR you are running).
I didn't have to go through the format portion of the fdisk as I had a nandroid backup which formats all the partitions itself.
If I've forgotten any steps please feel free to comment and include them.
Thanks to TeamWhiskey for helping me resolve this issue when I had it...
Don't forget to click the Thanks button if this helped...
When i get to
Code:
fdisk -h 1 /dev/block/mmcblk0
I get
Code:
unknown option -- hBusyBox v1.16.2androidminimal (2010-03-28 22:34:51 EDT) multi
-call binary.
Did i do anything wrong ?
exPos3D said:
When i get to
Code:
fdisk -h 1 /dev/block/mmcblk0
I get
Code:
unknown option -- hBusyBox v1.16.2androidminimal (2010-03-28 22:34:51 EDT) multi
-call binary.
Did i do anything wrong ?
Click to expand...
Click to collapse
My apologies it is the correct code but should be
Code:
fdisk -H 1 /dev/block/mmcblk0
"I sometimes forget linux commands are case sensitive"
After doing all the steps
When its time to write the tables by executing the "w" command i get this error
Code:
Command (m for help): w
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: D
evice or resource busy
exPos3D said:
After doing all the steps
When its time to write the tables by executing the "w" command i get this error
Code:
Command (m for help): w
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: D
evice or resource busy
Click to expand...
Click to collapse
seems as if I may have forgotten a step but I don't think that I did....
before doing the fdisk command try
Code:
mkfs /dev/block/mmcblk0
if that doesn't work goin into your adb shell and do an
Code:
fdisk -l /dev/block/mmcblk0
and
Code:
fdisk -H 1 /dev/block/mmcblk0
p
and paste the output
It worked thanks but now my sdcard still wont mount for any of my apps, or camera. I can add items to my sd card and install to it, but it still wont mount
I'm not in this area so i do not know where to find files ADB on my computer. If you have time, can you be more detailed instructions to help me ? thank you very much . I waiting for your answer,.
chulun9999 said:
I'm not in this area so i do not know where to find files ADB on my computer. If you have time, can you be more detailed instructions to help me ? thank you very much . I waiting for your answer,.
Click to expand...
Click to collapse
Please use the search function....
http://www.xda-developers.com/android/adb-easy-tutorial/
So I can boot into CWM, but when I try to use ADB it says "Device not found" ...
The phone will boot into the o2x OS, but I get no cell signal. When it boots into the OS, ADB finds it no problem.
Any suggestions?? Does ADB work with all versions of CWM??
Thanks so much for the partition table info!
Try this ... Stock nandroid
Command in windows
Can you post the command you mentioned for linux , to do it in windows . Am using windows 7 . LG update tool screwed my mobile and i have to proceed only with restoring the partition tables .
casper200519 said:
DISCLOSURE: Not responsible for you being retarded and breaking what doesn't need fixed.
DISCLOSURE 2: Do not use this on the O2x as it has a slightly different partition table.
Here is my step by step for repairing the internalsd Partitions... I don't think I've forgotten anything in this. If anyone knows how to write this into a .zip for flash via CWR it would be great. Credit goes to TeamWhiskey for helping me out when I screwed my partition table up...
WARNING: This can destory your internalSD card partitions. If it's not broke don't fix it!
ALL ENTRIES ARE IN RED
I am not responsible for any damage you do to your phone.
I did this same thing to my phone... I was still able to get into recovery though. You can repair the internal partitions through ADB if you can still get into recovery.
Steps to recreate partitions.
Boot into recovery
from your PC open cmd prompt
change to your ADB directory
run adb shell
fdisk -h 1 /dev/block/mmcblk0
once in the fdisk of ../mmcblk0 you might as well delete all the partitions if you believe that they are corrupted
d
1
repeat for partition 2-8
one all of your partitions are gone you now have a blank internal SD and will need to execute the following to restore all the proper partition sizes
Partition 1
n
p
1
First Cylinder start 129
First Cylinder stop 55168
We will repeat this for partitions 2 and 3
Partition 2
n
p
2
Start 55169
Stop 63360
Partition 3
n
p
3
Start 63361
Stop 63616
On to partition 4 which will be extended (this is the last partion you will choose primary or extended)
Partition 4
n
e
4
Start 63617
Stop 975424
Now onto partition 4-8 which are automatically selected as logicall partions (no option is given)
Partition 5
n
Start 63681
Stop 64704
Partition 6
n
Start 64769
Stop 65088
Partition 7
n
Start 65153
Stop 261760
Partition 8
n
Start 261825
Stop 975424
Once you have done this the partitions are ready to be written to the internalSD
I would recommend choosing the command p to verify that all of your start and stop blocks are correct.
From this point you have the option to either quit without saving changes "q" or to write the partition table itself "w". Once you are sure that you have entered all of your partitions correctly you can choose the command w
At this point you have recreated all the partitions on your InternalSD card. If you have a nandroid backup at this point you should be able to restore it without a problem once you copy it over to the internal or external (depending on which CWR you are running).
I didn't have to go through the format portion of the fdisk as I had a nandroid backup which formats all the partitions itself.
If I've forgotten any steps please feel free to comment and include them.
Thanks to TeamWhiskey for helping me resolve this issue when I had it...
Click to expand...
Click to collapse
Can you post the commands to do it from windows ?
bibinkalarikkal said:
Can you post the commands to do it from windows ?
Click to expand...
Click to collapse
Read and go step by step, these are for windows
Sent from my LG-P999 using XDA Premium App
Is there a way to use this app to create one partition just for user app storage? I don't want or need an internal sdcard partition!
Sent from my LG-P999 using xda premium
DUDE!!
Thanks to your instructions and one hour of simple restoration work and my G2X was back in the game. This is for those not faint of heart, but if you've made it far enuff to delete your Internal partitions...Then you could handle these instructions...
PROPZ!!!!
I couldn't do it.When I wrote fdisk -h 1 /dev/block/mmcblk0 to adb shell there was 4 different options.
Usage:fdisk [-ull] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b DISK
Change partition table
-u Starts and End are in sectors <instead of cylinders>
-l Show partition table for each DISK, then EXIT
-b 2048 <for certain MO disks>use 2048-byte sectors
-C CYLINDERS Set number of cylinders/heads/sectors
-H HEADS
-S SECTORS
~ #
I don't know what to do.Can you please help me with this?
I tried this because my device was failing while OneClickRecoveryFlash. NVError 0x120000
I'm about to get a g2x, however I have a question..
What causes bad partitioning table? Or messed up partition table?
nitrogen618 said:
I'm about to get a g2x, however I have a question..
What causes bad partitioning table? Or messed up partition table?
Click to expand...
Click to collapse
Flashing a G2X or WIND Optimus 2X which are the same LG-P999 handset with anything for the Optimus 2X (O2X) which is the LG-P990. They use the same internal hardware except for the cell radio modem and use different partition tables so their firmware and ROMs are incompatible. When the LG-P999 is flashed with LG-P990 stuff the LG-P999 will boot as an LG-P990 but there won't be any cell services.
Another reason is an incomplete flashing with LG-P999 firmware.
Core Memory said:
Flashing a G2X or WIND Optimus 2X which are the same LG-P999 handset with anything for the Optimus 2X (O2X) which is the LG-P990. They use the same internal hardware except for the cell radio modem and use different partition tables so their firmware and ROMs are incompatible. When the LG-P999 is flashed with LG-P990 stuff the LG-P999 will boot as an LG-P990 but there won't be any cell services.
Another reason is an incomplete flashing with LG-P999 firmware.
Click to expand...
Click to collapse
Ah, so basically they flashed a p990 rom on a p999.
Another question, when flashing a new rom on cwm you do
-clear data/factory reset
-clear cache partition
-clear dalvik cache
-install rom from sd
Right?

[GUIDE][ROOT] Resizing emulated SD card and userdata partitions

I originally created this guide for Sony Xperia T/TL/TX/V and have since discovered that the method works for other devices, too. So I present the universal guide to getting rid of that annoyingly tiny allocation of space for internal storage in devices that have plenty of it.
Kudos to @teidus for pointing me to this long-forgotten method.
Screenshots of proof are attached to my original post.
WARNING: You will lose a lot of data if you don't follow this guide!
WARNING: These operations require a rooted device. If you are running unrooted Android 4.3 or newer, you cannot proceed.
NOTE: All of these changes will be reversed if you flash a factory image that contains a partition table.
DISCLAIMER: I'm not responsible for bricked devices and data loss from power surges, hardware damage, or changes to the linked software. Always check the native manuals for all the tools listed here!
I'm also not responsible for your curiosity and desire to resize other partitions. I haven't tried that because messing with /system and /cache can lead to unexpected results.
Requirements:
1. Your device must currently have root access, CMW recovery v6.0.4.6 or later, less than 50% allocated to internal storage, emulated SD card (usually, it's /storage/sdcard0), and at least 8GB of total onboard memory. If you answered "No" to at least one of these, this guide won't help you. To check whether you have an emulated SD card, remove your physical SD card, go into a file manager app, and see whether you still have some sdcard listed.
2. A factory image flashing software for your device unzipped and/or installed on your computer. Look in the relevant forums for downloads.
3. ADB from either Android SDK or your device's flashing tool. Look in the relevant forums for instructions.
4. For locked bootloaders, factory firmware image with Android v4.1.2 or v4.0.x saved on your computer (consult your flashing tool's manual for the default location) - nearly 100% of these have root exploits. Look in the relevant forums for downloads.
5. Root exploit with Superuser or SuperSU installer for your device unzipped on your computer. Look in the relevant forums for downloads.
6. CMW recovery installer v6.0.4.6 or later compatible with your device and the factory firmware version obtained in step 4 unzipped on your computer. Look in the relevant forums for downloads.
7. File system utilities (attached) unzipped to a folder on your device's physical SD card you'll remember (I'll be using /fs-utils in this guide).
8. For Windows 8 users, ADB drivers for your device.​
The Guide (skip all the way to the bottom for the short list of ADB commands):
1. Back up all data stored on internal storage:
Option 1: Connect your device to the computer and save it to a computer drive.
Option 2: Open a file manager on the device and copy it to a physical SD card (/sdcard1).​2. Back up your current installation with either Online Nandroid or your current recovery and remove the SD card for safety.
3. Flash your device with basic 4.1.2 install.
Refer to the documentation for your tool.​4. Connect your device to the computer and let the computer recognize it.
5. Enable USB debugging.
5.1 Go to (System) Settings -> Developer options and flip the switch in the top-right corner of the screen.
5.2 Look a bit down (toward the middle of the screen) and check USB debugging.​6. Root your device.
Refer to the documentation for your tool.​7. Install recovery on your device.
Refer to the documentation for your tool.​8. Boot into CMW recovery.
Depending on the device, reboot into recovery may be available in the power menu, or you'll need to press/hold a button during the power on sequence. Refer to the documentation for your recovery.​9. After the device boots into recovery, connect it to the computer.
10. Start ADB shell in command prompt.
Navigate to the folder where adb.exe resides, hold SHIFT, right click the mouse, and select Open command window here, then type adb shell in the command prompt and press ENTER.​11. Execute the following commands one-by-one (you can copy & paste, hit enter, and wait for the output):
Code:
umount /storage
parted /dev/block/mmcblk0
print
These commands unmount all drives, launch parted utility for mmcblk0 (onboard flash storage), and display the partition table on your screen.​12. Write down the info from the following columns for partitions Userdata and SDCard (or Media). Usually, they are the last 2 partitions.
Column 1 - Number, Column 2 - Start, Column 3 - End, Column 5 - File system, Column 6 - Name. The start of the first partition and the end of the second partition are the limits, within which your new partitions will be created. The numbers are in megabytes (MB) unless specified. Make sure the name is recorded just as it appears in the partition table - Andorid is case-sensitive.​13. Remove the 2 partitions by executing the following commands:
Adjust the numbers according to your system.​
Code:
rm 14
rm 15
14. Calculate the new start and end point for both partitions.
For the first partition, the start point will be the same. For the second partition, the end point will be the same. The end point of the first partition is the start point of the second partition.
Take the end number for the first partition you recorded in step 12, add more space to get the new end. Alternatively, if your first partition is actually the emulated storage, subtract the reallocated space to get the new end point. I advise to add at least 2GB (2048MB) to Userdata feel safe about having enough storage for apps. DON'T TRY TO REMOVE EMULATED STORAGE ALTOGETHER BY ALLOCATING ALL OF THE AVAILABLE SPACE TO USERDATA! Emulated storage is coded into OS environment and requires additional modifications to work properly.​15. Create and name new partitions by executing the following commands (don't copy the text in parentheses):
The system might throw several errors in the process. When prompted, just type ignore and hit ENTER.​
Code:
mkpartfs logical ext2 OLD_START NEW_END (change ext2 to fat32 if the first partition had that file system)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 NEW_START OLD_END (change ext2 to fat32 if the second partition had that file system; make sure to include GB as the designation of the end point in order to stretch the partition to the end of the onboard storage)
name 15 SDCard (change the number and the name according to your environment)
quit
These commands create the partitions with ext2 file system and given beginning and end parameters, rename them as required, and close parted.​16. "Damage" the internal, emulated SD card so that it could be formatted properly later. REMOVE YOUR PHYSICAL SD CARD BEFORE THIS STEP TO AVOID WIPING THE WRONG CARD!!!
Tap Mounts and storage -> Format /storage/sdcard0 -> default and confirm the operation.​17. Insert the physical SD card (sdcard1) that you removed in step 2 back into the device.
Make sure it's mounted by going to Mounts and storage and checking its status (it should say unmount /storage/sdcard1/). If not, mount it by executing on the appropriate option.​18. Execute the following commands one-by-one in the ADB command prompt:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​19. Reboot the device into full Android.
19.1 Remove the physical SD card for safety.
19.2 Go to the top menu level of recovery. Then select the top option Reboot the device.​20. When Android loads fully, you'll notice a notification about storage file system. Tap it and follow the prompts to format it.
21. Insert the physical SD card and reboot into the recovery to restore the backup from step 2.
Backup and Restore -> Restore from /storage/sdcard1.​22. Reboot back into full Android and copy the files saved from internal storage back into it. Then reboot again so that apps recognize the data.
DONE!​
Short guide/list of ADB commands and other events (*enclosed in asterisks*) if you know the safety drill & bash-based parted utility:
Code:
*flash 4.1.2 & install recovery*
*boot recovery*
adb shell
umount /storage
parted /dev/block/mmcblk0
print
*record start point of Userdata and end point of SDCard*
rm 15 (change the number according to your environment)
rm 14 (change the number according to your environment)
mkpartfs logical ext2 1621 7865 (change the numbers according to your environment)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 7865 15.6GB (change the numbers according to your environment)
name 15 SDCard (change the number and the name according to your environment)
*remove physical SD card*
*Mounts and storage -> Format /storage/sdcard0 -> default -> confirm*
*insert physical SD card*
*Mounts and storage -> Mount /storage/sdcard1*
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
*remove physical SD card*
*reboot*
*format emulated SD card*
*reboot recovery*
*restore backup*
*reboot*
*restore sdcard0/*
*reboot*
FAQ
Will it work with Android 4.2/4.3/4.4 or an older version of recovery?
So far I have tested with the versions mentioned in the guide. You can test whether this method will work for your setup without jeopardizing any data by completing step 7 of requirements and executing the following commands in ADB shell after booting into your recovery:
Code:
parted /dev/block/mmcblk0
print *wait for output*
quit
cd /storage/sdcard1 *change if your physical sdcard is sdcard0*
tune2fs *no parameters*
e2fsck *no parameters*
No errors indicate the method works for you. Please make sure to tell me about your setup in the comments - I'll update the compatibility list.
Tested devices
Did it work on your device or did you fail? Leave a comment and I'll update the list!
Barnes & Noble
- Nook Tablet 16GB
Sony
- Xperia T/TL/TX
Links to tools and recoveries
Reserved
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
derpotato said:
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
Click to expand...
Click to collapse
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
bsined said:
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
Click to expand...
Click to collapse
Oh I see.. that's too bad. Well, thanks for the information
ignore this
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
sourabhp said:
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
Click to expand...
Click to collapse
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
bsined said:
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
Click to expand...
Click to collapse
I searched with google for ADB drivers in recovery mode and found one but even after that device was not detected in recovery mode.
I tried uninstalling and re-installing drivers but no luck. may be need more research
bsined said:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​[/code][/hide]
[/size]
Click to expand...
Click to collapse
Thanx bro. I have successfully partitioned my device (Xperia L).
But when I checked the file system, it is ext3 not ext4.
Still my device is running well.
Will it effect the performance of my device?
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
jjiiaa said:
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
Click to expand...
Click to collapse
First off, SYSTEM partition isn't that big - less than 1GB, so you won't gain much from shrinking it. Secondly, I'm not sure where recovery is written. You're risking bricking your phone. Lastly, if you shrink the partition too tightly, you'll effectively remove the ability to upgrade your device's firmware because all ROMs have various sizes.
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
israfild said:
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
Click to expand...
Click to collapse
I think Android 4.4+ utilizes the entire internal storage as a single block, so the guide is pointless. If that's not the case on your device and you're willing to be the guinea pig, please do attempt the repartitioning and report on the results.
Sent from my LT30p using XDA Free mobile app
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
zero995 said:
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
Click to expand...
Click to collapse
Just double-checking that you had downgraded to 4.1 before resizing. You should be able to recover your device by flashing any FTF with Flashtool.
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
zero995 said:
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
Click to expand...
Click to collapse
If the phone doesn't start at all, that doesn't sound like it's related to partition tables. If the screen, the vibrator, and the LED turn on, the phone is in a soft brick and should be recoverable. You should ask in the FTF threads if you get any errors in flashtool.

[Q] /data partition unable to wipe

Hey guys,
I had previously encrypted my phone with the inbuilt android encryption, but it just didn't work (the PIN wasn't my password)
I tried to factory reset it but it didn't work either, from both fastboot or recovery.
So I reflashed my entire system from fastboot (which worked perfectly). Now I want to install the unofficial cm12 zip, but I can't erase userdata from my phone at all.. Either through fastboot or recovery, and I'm locked to the GPe image I am using currently.
The recovery error I get when trying to delete my data partition is:
Code:
-- Wiping data...
Formatting /data...
Error mounting /data!
Skipping format...
Formatting /cache...
Formatting /sd-ext...
E:unknown volume for path [/sd-ext]
Formatting /sdcard/.android_secure...
Error mounting /sdcard/.android_secure!
Skipping format...
Data wipe complete.
I have no idea what to do help please?
Possible solution
Okay, so the CWM recovery is beyond stupid and seems to want to verify that it can read a partition before it lets you format it. But you can't do this if you've encrypted it. So you have to reformat it yourself. But first, you have to figure out the device name of that partition.
After you've booted the phone into recovery, you'll need to send commands to the phone with adb.
Type this to receive an error revealing a device name:
Code:
adb shell mount /data
Then type the following using the /dev/ name given in the error from the first command. That device name might be unique to my phone. I'm not sure:
Code:
adb shell ls -l /dev/block/platform/msm_sdcc.1/by-name/
In any case, you want to find where userdata is pointing to. On mine, it is:
Code:
/dev/block/mmcblk0p36
Then to double check which type of filesystem is being used on that userdata partition:
Code:
adb shell cat /etc/fstab
Then to format it yourself (if f2fs is the filesystem) since CWM recovery won't bloody well do it and lets everyone think they've bricked their phone:
Code:
adb shell mkfs.f2fs /dev/block/mmcblk0p36
Disclaimer: this worked for me, but I can't make any guarantees. It got me past the error CWM was giving. After I formatted the partition on my own, CWM recovery was able to proceed as normal.
Worked for me atleast
1) You Need twrp recovery.
2)Select data partition.
3)Change file system to some other than f2fs.
4)Again change file system to f2fs (without rebooting recovery).
5)Repair Partition with twrp menu.
6)If Partition repair was successful then wipe the Partition.
7)? Good to go.
8)And yeah though it doesn't brick your phone if anything happens to your device then I am not responsible.
jlm0 said:
Okay, so the CWM recovery is beyond stupid and seems to want to verify that it can read a partition before it lets you format it. But you can't do this if you've encrypted it. So you have to reformat it yourself. But first, you have to figure out the device name of that partition.
After you've booted the phone into recovery, you'll need to send commands to the phone with adb.
Type this to receive an error revealing a device name:
Code:
adb shell mount /data
Then type the following using the /dev/ name given in the error from the first command. That device name might be unique to my phone. I'm not sure:
Code:
adb shell ls -l /dev/block/platform/msm_sdcc.1/by-name/
In any case, you want to find where userdata is pointing to. On mine, it is:
Code:
/dev/block/mmcblk0p36
Then to double check which type of filesystem is being used on that userdata partition:
Code:
adb shell cat /etc/fstab
Then to format it yourself (if f2fs is the filesystem) since CWM recovery won't bloody well do it and lets everyone think they've bricked their phone:
Code:
adb shell mkfs.f2fs /dev/block/mmcblk0p36
Disclaimer: this worked for me, but I can't make any guarantees. It got me past the error CWM was giving. After I formatted the partition on my own, CWM recovery was able to proceed as normal.
Click to expand...
Click to collapse
@jlm0 Hope your post will help me. I have terminal emulator, with this how do I run these commands, because I'm not able to change the recovery also.
Regards
Janardhan TS
sent from Mi

Just ran a manual format of /data/ in twrp terminal cmd when do i know its done? PLZ

i ran this command.
mke2fs -T ext4 /dev/block/mmcblk0p44
right now the screen says Writing superblocks and filesystem account information : 0/201(a bunch of rectangles here) (a bunch more rectangles)done
does the done at the end mean it's done? the reason i'm confused is the developer that recommended this command to format an encrypted drive said it would take hours... but it stopped there and appears to be doing nothing now? is it done or should i wait longer?
the reason i'm confused is formats are usually fast because they just rewrite the partition table i thought? or is this a full format where it writes 0's to the entire drive?
plz answer if anyone knows how to tell when this format is done. i can post entire log of format if needed.
KronicSkillz said:
i ran this command.
mke2fs -T ext4 /dev/block/mmcblk0p44
right now the screen says Writing superblocks and filesystem account information : 0/201(a bunch of rectangles here) (a bunch more rectangles)done
does the done at the end mean it's done? the reason i'm confused is the developer that recommended this command to format an encrypted drive said it would take hours... but it stopped there and appears to be doing nothing now? is it done or should i wait longer?
the reason i'm confused is formats are usually fast because they just rewrite the partition table i thought? or is this a full format where it writes 0's to the entire drive?
plz answer if anyone knows how to tell when this format is done. i can post entire log of format if needed.
Click to expand...
Click to collapse
nevermind i got brave and ran the regular format on /data/ and its all good. by the way this is how you can format an encrypted drive in twrp (since you will get a mounting error from usual wipe method). MAKE SURE you use the proper partition address though, the one that i have here is for LG G3 d852 only.
download a parition information app to check the address of your data partition before you try this command.
this is similar to doing a hard reset on a stock device, when you reboot it will look similar to a fresh install with some acceptions. note: every device is different i cannot guarantee anything

Categories

Resources