unCoRrUpTeD SD--PARTITIONER [Partition SDCARD without losing fat32 contents] (SCRIPT) - Android Software Development

This is outdated and probably does not work.
UnCoRrUpTeD SD--PARTITIONER​
I have made this really easy to partition your sdcard while preserving all data on the fat32 partition.This one is used to setup your sdcard for a2sd and swap instead of using the built in partitioning program, which will destroy all your fat32 contents. Eventually I will add support for backing up the ext partition if you want to resize the existing partitions.
You have the option of specifying the size of the partitions in /sdcard/sdpartmap.txt
To specify your own sizes and filesystem do..
Code:
c:\xxxxxx\adb shell
/ # echo 150 200 ext4 > /sdcard/sdpartmap.txt
replacing 150, 200, ext4 with your own
.
The 1st number is a2sd data partition (system/sd or sd-ext mounted at /dev/block/mmcblkXp2)
The 2nd number is swap partition. (mounted at /dev/block/mmcblkXp3)
The 3rd entry will be for ext3 or ext4 FS
It's best to do a2sd data in increments of 256MB and
swap in increments of 32MB
If you don't specify an ext type it will default to ext2.
If there is no sdpartmap.txt file the partitions will be automatically set to
a2sd data = 256
swap = 0
ext type = ext2
Make sure you have enough free space on the card to accommodate the extra partitions until I incorprate checks for that.
INSTRUCTIONS:
1. Download unCoRrUpTeD_SD--PARTITIONER.zip
2. Reboot into recovery
Code:
adb shell reboot recovery
3. Unzip the contents of sdpart.zip. There should be a folder named sdpart. Push the files inside sdpart folder to /tmp/
Code:
adb push c:\xxxxxx\sdpart /tmp/
4. run /tmp/sdpart.sh in adb shell
Code:
adb shell /tmp/sdpart.sh
If sdpart.sh doesn't run then you will have to chmod it before running it, but it should already have permission to run.
Code:
adb shell chmod 777 /tmp/sdpart.sh
If for some reason you can not push the files mount your sdcard through your phone and copy the sdpart folder to your sdcard and then
Code:
adb shell reboot recovery (might need to do adb reboot recovery or just reboot into recovery)
adb shell
mount /sdcard
cp -a /sdcard/sdpart/* /tmp
/tmp/sdpart.sh

you said you could make it into a flashable Zip /
Would love to see this.
ADB Retarted.....

mahalocat said:
you said you could make it into a flashable Zip /
Would love to see this.
ADB Retarted.....
Click to expand...
Click to collapse
That's why I put step by step instructions. I'll have to find the flashable one.
Sent from my HERO200 using XDA App

Worked wonderfully!!!

will try out, thanks.

Does this work for the droid incredible?

It should work on any phone, but you should back up your sdcard to a PC every once in a while just in case your sdcard gets corrupted or quits working.
Sent from my HERO200 using XDA App

How can I tell if it worked? Can I check my partition sizes or my ext somehow?

nagasgura said:
How can I tell if it worked? Can I check my partition sizes or my ext somehow?
Click to expand...
Click to collapse
I'll add some things to the OP later today. When you run the script it should output your SD partitions before and after.
Sent from my dual-booted liquidsense 2.1

how to do in te???
no pc guy/....

You've got to be kidding me.
Saves me the trouble of transferring 16 GB everytime I partition.
Waiting for the flashable zip.
Sent from my Galaxy Fit @ 801Mhz- RazoDroid

Dude what ever happened to the whole dualboot thing for every phone I really wanted that
via tha xquizit EII4G ♚ of phonez

Hey you did a good job but there's some bugs in it
the script
Code:
$parted $extmount -s mkpartfs primary ext2 $newfat $newa2sd &> /dev/null ;
if [ "$exttype" = "ext4" ] ;
then
$mke2fs -T ext4 ${extmount}p2 &> /dev/null ;
fi
obviously ,it can't creat ext3
so I crrect it
Code:
$parted $extmount -s mkpartfs primary ext2 $newfat $newa2sd &> /dev/null ;
if [ "$exttype" = "ext2" ] ;
then
$mke2fs -T ext2 ${extmount}p2 &> /dev/null ;
elif [ "$exttype" = "ext3" ] ;
then
$mke2fs -T ext3 ${extmount}p2 &> /dev/null ;
elif [ "$exttype" = "ext4" ] ;
then
$mke2fs -T ext4 ${extmount}p2 &> /dev/null ;
fi

great work man, thanks for this!

dswaggz said:
Dude what ever happened to the whole dualboot thing for every phone I really wanted that
via tha xquizit EII4G ♚ of phonez
Click to expand...
Click to collapse
I ran into a problem with my java code and got frustrated with trying to figure out why it doesn't work correctly. That and my wife was getting upset that I was on the computer all the time. I have been running the stock ROM on my EVO 3D since getting it on launch day and just recently flashed some ROMs in Boot Manager to test some things out.

What if I wanted to go back and delete the ext partition?

Somehow I fail to see how this is easier than using the parted that's built in to almost every recovery out there.
But maybe that's just me.

Just make the fat partition the size of the sdcard and swap and ext both 0.
When using parted in recovery you lose your data (pics, downloads, backups, etc). This way you won't lose anything.
Sent from my PG86100 using XDA App

Sounds great.. is flashable zip available yet?
Sent from my HD2 using xda premium

If i already have a 2048 mb ext4 and i want to add a swap partition what i have to do
Sent from my HTC HD2 using XDA

Related

Question about recent Recovery Images

Okay, so I have used four recovery images since I have had my G1 and now the myTouch 3g. Two from Cyanogen when I had my G1. When I rooted my MT3G I had Amon_Ra's 1.2.0G and 1.2.1G. Today I flashed Twisted's Recovery Image. Both Amon's and Twisted's give the option to partition your memory card (Fat32, Ext2, and Linux-Swap). I love that because it makes things so much easier. Well, getting to the point of this thread. Are there any recovery images that format just the ext. part of our memory cards? Is that even possible? I ask because I flash different ROM's every few days and I like to wipe my ext3 to give it a fresh start for each ROM. I know it's just a few codes through ADB, but I'm sure I'm not alone when I say I like to be lazy. That would make things so much easier. Thanks in advance for any feedback.
To wipe your ext3 data ..
Code:
adb remount
adb shell rm -rf /system/sd/*
adb shell rm -rf /data/dalvik-cache/*
This should be the last thing you do before you flash as it will stop stuff from working properly!
In case you need more information: Connect your device and type "adb shell" and then do "mount | grep mmcblk0p2", this will show you where your ext2/3 partition is mounted (mmcblk0 represents your sd card, and p2 is the second partition) :
Code:
# mount | grep mmcblk0p2
mount | grep mmcblk0p2
/dev/block/mmcblk0p2 on /system/sd type ext2 (rw,noatime,nodiratime,errors=conti
nue)
/dev/block/mmcblk0p2 on /data/dalvik-cache type ext2 (rw,noatime,nodiratime,erro
rs=continue)
exit

new rootfs...

posted a new rootfs over at http://code.google.com/p/vogue-android
If you have a system partition AND a swap partition, but no data partition, it'll blow up.
to use it normally, just drop it in and go.
If you want to do partitions, bring up partition magic(windoze), or gparted(linux) with the card inserted but not mounted.
Resize or delete the first/primary partition, then create partitions as follows:
p1: most of the disk, fat32
p2: about 256MB should be plenty, ext2 for system
p3: about 256MB should be plenty, ext2 for data (optional)
p4: whatever you want, ext2 for swap (optional and not recommended)
then reformat p1 and add all your stuff to it. you don't have to bother formatting the other partitions as the built-in installer will do that for you.
boot up and when prompted push volume down to initiate the installer, then follow the on-screen prompts.
quick history:
11/14: lots of progress with data, but disconnecting failed
11/15: fixed disconnects in data and made it work with a partitioned card (but broke it for a non-partitioned card)
11/16: fixed non-partitioned cards and made it work if you only have a system partition.
Trying now.
ED: Aw craps. I'm using an ext2-style installation and it doesn't work.
Nice, thanks.
Will this be compatible with what Msmison has going on?
cybik said:
Trying now.
ED: Aw craps. I'm using an ext2-style installation and it doesn't work.
Click to expand...
Click to collapse
I'm using an ext2 image (system.ext2) just fine. R u using an ext2 image or ext2 partition?
Thanks vilord - so far everything works well but I'll post results after using it all day.
sshark said:
Nice, thanks.
Will this be compatible with what Msmison has going on?
Click to expand...
Click to collapse
Today or tomorrow The work is done it just has to be tested and integrated.
thanks vilord! and welcome back
I've altered the init to boot off of the ext2 partition:
Code:
diff rootfs-vilord/init rootfs-14-11-09-ext2part/init
86,104c86,87
< if [ -e $card/system.ext2 ] ; then
< echo "Using uncompressed system"
< losetup /dev/block/loop1 $card/system.ext2
< [ $? -eq 0 ] || fail "Failed to reach system.ext2 on SD Card"
< e2fsck -y /dev/block/loop1
< mount -t ext2 -o noatime,nodiratime /dev/block/loop1 /system
< [ $? -eq 0 ] || fail "Failed to mount /system"
< elif [ -e $card/system.sqsh ] ; then
< echo "Using SquashFS system"
< losetup /dev/block/loop1 $card/system.sqsh
< [ $? -eq 0 ] || fail "Failed to find system.sqsh on SD Card"
< mount -t squashfs -o ro,noatime,nodiratime /dev/block/loop1 /system
< [ $? -eq 0 ] || fail "Failed to mount /system"
< else
< losetup /dev/block/loop1 $card/system.img
< [ $? -eq 0 ] || fail "Failed to find system.img on SD Card"
< mount -t cramfs -o ro,noatime,nodiratime /dev/block/loop1 /system
< [ $? -eq 0 ] || fail "Failed to mount /system"
< fi
---
> mount -t ext2 -o noatime,nodiratime /dev/block/mmcblk0p2 /system
> [ $? -eq 0 ] || fail "Failed to mount /system"
Available for download here. Removed at mssmisions request
Testing now...
Vilord you ARE the man!! I was having odd problems with senseHero 1.3.3 where data only worked with a fresh system installation and fresh data... No more problems!!! I am using my rootfs posted above with senseHero on my Kaiser. WOW. I'll test some donut builds soon and see if that solved our Kaiser donut problem too!.
/me kicks himself for talking about Kaisers again in the Vogue forum
Edit: I made a thread in the Kaiser forum so us Kaiser users can talk over there.
polyrhythmic said:
Vilord you ARE the man!! I was having odd problems with senseHero 1.3.3 where data only worked with a fresh system installation and fresh data... No more problems!!! I am using my rootfs posted above with senseHero on my Kaiser. WOW. I'll test some donut builds soon and see if that solved our Kaiser donut problem too!.
/me kicks himself for talking about Kaisers again in the Vogue forum
Edit: I made a thread in the Kaiser forum so us Kaiser users can talk over there.
Click to expand...
Click to collapse
thanks man i was gonna add ext2 support you beat me to it
Thanks, the parition support is really coming along, with an all new way of doing things, my phone was drying after falling in the dog dish so vilord has been working on it today.
Maybe a placebo but it seems to have made my Xrom (1.5) more snappy.
I removed the link from my post, now you just have to remove it from your quote
It already runs so well, looking forward to whatever could be better!
Cheers
I'm having slow home screen refreshes using this rootfs with donut on Vogue... if I visit a few sites and then go back to home (long cam press) the screen takes some time to come up. This is new behavior with this rootfs... can somebody confirm this or is it just me?
updated with the partitioning support and a refactored installer based on mssmison's work.
now if you have three partitions, mmcblk0p1, p2, and p3, where p1 is your regular vfat/fat32, p2 is system, and p3 is data, it will use the partitions. To install a system to those partitions, press volume down when prompted, and it'll guide you through the options for installing your system and data to the partitions.
memfree values were updated slightly to improve performance, but at the expense that it will kill off a couple more background processes (like home screen) when things are eating up lots of memory... try it without compcache and see what you think... the numbers can be adjusted again if it sucks to much.
vilord said:
updated with the partitioning support and a refactored installer based on mssmison's work.
now if you have three partitions, mmcblk0p1, p2, and p3, where p1 is your regular vfat/fat32, p2 is system, and p3 is data, it will use the partitions.
Click to expand...
Click to collapse
Interesting and thanks.
Could you pl tell what should be partition type for data partition? FAT32 or Ext2?
sshark said:
Interesting and thanks.
Could you pl tell what should be partition type for data partition? FAT32 or Ext2?
Click to expand...
Click to collapse
For now, data and system partitions should be ext2, although the filesystem will be created when running the installer, you just need to create the partitions.
Coming eventually will be either nilfs2 or some other log-centric filesystem that doesn't freak out when you pull the plug.
For the partitions, I would suggest about 256MB for each of system and data, although if you're tight on space, 128 should be enough for now for each.
New partitionning system works, zen's 1.6 Droid-Ion-Donut is purring. So, a beer to you, Jesse (i think i owe you two now!). And it also got the GPS working!
Ed. : Scratch the PPP issues. My signal sucked.
what are you seeing specifically with the PPP? I'm seeing rock-solid right now, but i don't know what'll happen tomorrow on the subway to work
regarding GPS, It might only work the first time, and only if it was turned on in winmo before you rebooted... we're still looking into that one.
vilord said:
For now, data and system partitions should be ext2, although the filesystem will be created when running the installer, you just need to create the partitions.
Coming eventually will be either nilfs2 or some other log-centric filesystem that doesn't freak out when you pull the plug.
For the partitions, I would suggest about 256MB for each of system and data, although if you're tight on space, 128 should be enough for now for each.
Click to expand...
Click to collapse
This thing works flawlessly, as you suggested, I have fat32, ext2 (sys) and ext2 (data) partitions. No errors in upgrade and this things flies.
thanks.
Are three partitions really necessary? Can we not use two like with v2.2? IE, Fat32 and 500mb ext2.
I think this thread should focus toward the new installation system. I see it being confusing what it all means for new users without new instructions. Esp. determining size of partitions and what steps to take for installation.
EDIT: Things seem to be going significantly slower with the three partitions and the new installation than it was before with two. Not sure why.

[TIP] Howto Enable Swap

I used the method to enable swap in Linux and it works like designed.
I used Amon_RA Recovery 1.5.2 to partition my SDCARD and the new recovery lets you choose the size of your partitions.
So I created a 256MB Swap.
From a console/terminal do the following after creating your swap partition the size you want it:
Type each line below in order and hit enter after each in the terminal.
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mkswap /dev/block/mmcblk0p3
echo "swapon -a" >> /system/etc/init.d/05userinit
echo "/dev/block/mmcblk0p3 swap swap" >> /system/etc/fstab
reboot
This works on all roms i have run into. It does help the performance on the memory hobbled G1.
Once you have rebooted go back into a terminal and run the "free" command. You should see that you have a working swap partition.
TGA_Gunnman
The UNIX Dude
256 is over-kill. Most would say 96mb is the most you should have.
256 was not a recommendation is was a personal choice but based on usage and performance matrix I gathered it made since to have 256 to me.
TGA_Gunnman
What are the commands to raise or lower the swappines?
Allright, search than ask found it here
the swapon -a command seems to require superuser for me so I can't get it to work automatically in the user init script. I'm running CM 5.08 on my Dream.
You forgot
chmod 755 /system/etc/init.d/05userinit
Cool do u know if this would work on htc magic 1.2 all roms or can u provide a script for easier doing
Sent from my HTC Magic using xda app-developers app

[Need Dev Help] shrinking system.ext2

hey
i wanna shrink desire z bulid to something around 270mb
then i remove same apps with titanium backup
and few animations of the boot and shutdown and other jpgs that take space
using file explorer with root
so the system.ext2 is shrink by around 100mb
from 370mb to 270mb but file size is the same i need to capture it
those cmds i used
Code:
sudo su
dd if=/dev/zero of=/dev/system.ext2 bs=1048760 count=270
[ dont remember the correct bs ]
mke2fs -F system.ext2
mount -t ext2 system.ext2 /media/sys2 -o loop
mcopy /media/sys2/* /media/sys
umount /media/sys
all went fine
but when i wanna use the new system.ext2 which 270mb its wont load it stuck
and the original system.ext2 which is 370mb or more is working
what im doing wrong
Proz00 said:
but when i wanna use the new system.ext2 which 270mb its wont load it stuck
and the original system.ext2 which is 370mb or more is working
what im doing wrong
Click to expand...
Click to collapse
Hi. I want to do this too - sort of. Can YOU pleasssssseeeeeeeee HELP>>>????
phoenixtraveller said:
xCan someone tell me why it stops at desktop ubuntu?
I copy all linux files to sdcard \linux and setup magldr sd-boot to here.
COPY (not renamed) initrd.cpio.gz to initrd.gz and adb_zimage to just zImage.
partitioned sd card previously with 4096-ext and 256-cache (16gb) using CLOCKWORK OF COURSE.
NAND=clockwork/blank.
Boots.
But can someone help me/make a boot.img+system.img(containing FIXED initrd.gz and zImage) PLEASE - and proper flash.cfg for daf.exe ???
or UPDATE.ZIP for clockwork install ???
Thanks.
Will donate $.
Click to expand...
Click to collapse
ubuntu/magldr/clockwork/hspl...
And - How to mount rootfs.ext2 to YAFFS2/Nand? or even data.img? or sdcard partition ? GpartedLive?
Please: just want a simple boot.img+system.img combo that will allow daf.exe to install (correct parts etc) Ubuntu to NAND - and if this not possible then at least cut down version (resize rootfs.ext2 and mount to sd???) for AD SD BOOT.
Can anyone please help?
Thankyou.
Proz00 said:
hey
i wanna shrink desire z bulid to something around 270mb
then i remove same apps with titanium backup
and few animations of the boot and shutdown and other jpgs that take space
using file explorer with root
so the system.ext2 is shrink by around 100mb
from 370mb to 270mb but file size is the same i need to capture it
those cmds i used
Code:
sudo su
dd if=/dev/zero of=/dev/system.ext2 bs=1048760 count=270
[ dont remember the correct bs ]
mke2fs -F system.ext2
mount -t ext2 system.ext2 /media/sys2 -o loop
mcopy /media/sys2/* /media/sys
umount /media/sys
all went fine
but when i wanna use the new system.ext2 which 270mb its wont load it stuck
and the original system.ext2 which is 370mb or more is working
what im doing wrong
Click to expand...
Click to collapse
It should be working.
270M = 276480
Code:
sudo su -
mkdir /mnt/system
mount -o loop system.ext2 /mnt/system
genext2fs -d /mnt/system -b 276480 system.ext2.new
umount /mnt/system
rmdir /mnt/system

[HOW-TO] Make Ext4 from Recovery Without Losing FAT32 Data

I've seen a lot of threads detailing how to create an Ext4 partition using Gparted but if you don't want to download the image and would rather do it all on your phone, here's how:
This entire procedure should take less than 5min so you can go back to messing with your phone in other ways.
REQUIRES:
CLOCKWORK MOD RECOVERY
ADB
FINGERS
I am not responsible for any damage done to your phone doing this process. =.=
1. Download the zip file provided.
2. Extract the zip file to the same folder you have ADB in. (You should now have a folder named ext4 in the same folder you have ADB)
3. Reboot the phone into MAGDLR. Then select the option to boot into the recovery.
4. Make sure that /system/ is mounted using the option to mount partition in Clockwork Recovery.
5. Open a command (cmd) prompt and cd into your folder with ADB.
6. Run these commands in the command prompt. (Commands are in BOLD)
adb push ext4 /system/etc/
adb shell
parted /dev/block/mmcblk0
print (make note of the total size of your partition here)
resize 1 0 xxxx (where xxxx is the size you want for your FAT32 partition. It should equal total size of your partition that you gleaned from print minus 1024 for the ext4 partition you're about to set up)
mkpartfs primary ext2 xxxx yyyy (where xxxx is where your previous partition ended and yyyy is the total size of your sdcard)
.... (Let it do its thing. Shouldn't take more than a minute)
print (Make sure that everything is correct: You have a fat32 partition running from 0 to xxxx and an ext2 partition running from xxxx to the total size of your partition)
quit
Now to utilize the two files we previously pushed to /system/etc/
chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/e2fsck
/system/etc/tune2fs -j /dev/block/mmcblk0p2 <- You now have ext3
/system/etc/tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2 (Note: CAsE SEnSitiVE)
/system/etc/e2fsck -fpDC0 /dev/block/mmcblk0p2 (Note: CAsE SEnSitiVE) <- You now have ext4
7. You can check that it's truly ext4 by:
parted /dev/block/mmcblk0
print (It should now read that you have a FAT32 and an ext4 partition.)
quit
You're all done! Now you have a 1GB ext4 partition for all your data and apps. If you know what you're doing, these same steps can be modified so that you have two ext4 partitions if you'd like. You can also alter the size of your ext4 partition to something smaller if you don't have that many apps to install or have a smaller SDcard (512MB should be sufficient in most cases, 1GB is slightly overkill IMO)
i will try with my HD2. I need more space to install app on sd not on phone. Thanks so much
Hi, I follow your instruction but when I get a "Permision deined" error when I type in the following commond
/system/etc/tune2fs -j /dev/block/mmcblk0p2
Can you please help?
Many many thanks!!
justj said:
Hi, I follow your instruction but when I get a "Permision deined" error when I type in the following commond
/system/etc/tune2fs -j /dev/block/mmcblk0p2
Can you please help?
Many many thanks!!
Click to expand...
Click to collapse
Crap. I forgot a step. You have to type
chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/e2fsck
prior to using those files. That should fix the permission denied error.
I've edited the OP to reflect the changes, thanks for pointing that out.
Thanks man
Thanks Bro I have successfully make ext4 and I am enjoying my new Rom
Using HTC Desire runnymede 5.0
Amazing. I will keep it for future reference, although I partitioned my SD with CWM recovery and Gparted.
What kind of partition is made when using CWM? I made a 1GB partition on my card that way, and it works great. But I've heard good things about having it as ext4. How does this guide reflect the fact that I already have an SD-EXT on my card that's not necessarily ext4?
Thanks!
please help
please help me i cant get it to work... its same with /system mounted and unmounted...not even one 3rd app is working for me on my win 7 64x when i want to create ext4 this is my last hope. card is brand new 8gb ultra speed its working fine so cant be problem there. it seems like chmod 777 will delete that file..
Code:
C:\Users\OgziR\Desktop\adt-bundle-windows-x86_64-20130522\sdk\platform-tools>adb
push ext4 /system/etc/
push: ext4/tune2fs -> /system/etc/tune2fs
push: ext4/e2fsck -> /system/etc/e2fsck
2 files pushed. 0 files skipped.
1573 KB/s (603400 bytes in 0.374s)
C:\Users\OgziR\Desktop\adt-bundle-windows-x86_64-20130522\sdk\platform-tools>adb
shell
~ # /system/etc/tune2fs -j /dev/block/mmcblk0p2
/system/etc/tune2fs -j /dev/block/mmcblk0p2
/sbin/sh: /system/etc/tune2fs: Permission denied
~ # chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/tune2fs
~ # /system/etc/tune2fs -j /dev/block/mmcblk0p2
/system/etc/tune2fs -j /dev/block/mmcblk0p2
/sbin/sh: /system/etc/tune2fs: not found
~ #
Hye... I have 2 question...
My phone is a HTC HD2 running an NexusHD2.ICS.CM9.HWA.V2.3 ROM... The cmd prompt cant seem so fine my device. Do have any advice on this???
Secondly, what do i do with the ext4.zip file??? I mean, do it extract it, or put in same folder with ADB??
Btw, i am Super Noob on this, so i apologize if my question offends anyone... 1000 apologizes...
OK, first of all, do you have adb installed correctly? If cmd prompt can't find your device that is the most likely problem.
As for what to do with ext4.zip, you need to extract it to your adb folder.
Sent from my Vivid 4G using xda app-developers app

Categories

Resources