Early Lollipop Ports for Micromax A116 and A117

It feels like it was only yesterday when Google announced the mysterious Android L.After … more

Now Gesture Tweaks Replaces Google Now with Custom Action

On most modern Android devices with software navigation keys, swiping up from the … more

ToqAN Fixes Android 5.0 Notification Bug on Qualcomm Toq

The Qualcomm Toq is probably one of the lesser known smartwatches on the market … more

How to Root and Unlock the Google Nexus 6 on a Mac – XDA TV

In the past, XDA Developer TV Producer droidmodd3rx has shown you how to … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[UTIL] sdparted v0.6 - easy sdcard partitioning, upgrading to ext3/4

OP 51dusty

3rd August 2009, 09:20 PM   |  #1  
51dusty's Avatar
OP Senior Member
Flag bville, md
Thanks Meter: 12
 
144 posts
Join Date:Joined: Feb 2009
More
this script automates the process of partitioning a sdcard on your android device. it should work fine for all sizes/types of sdcards, but since i can't test all sizes/types of sdcards, we'll have to see.

if you are running into problems with the script, post the log file(located at /data/sdparted.log) when asking for help.

big ups to cyanogen (parted and upgrade_fs) and Denkai (upgrading to ext4).

i welcome all comments, questions & suggestions, related to the script. this is NOT a general q&a.

read the ENTIRE post BEFORE asking questions, please.

to manually partition your sdcard see my other thread.

DISCLAIMER: i take no responsibility for what happens to you, your phone, sdcard, data, sanity, etc if you use this script. remember to backup your sdcard to your pc before you begin. this script has the potential to COMPLETELY WIPE your sdcard!

##########################

shameless promotion:
sdparted can also be found in amon_ra's recovery and natalic's android toolkit.
##########################

features:
-automated partition of sdcard using parted
-upgrading to ext3/ext4
-downgrading to ext2
-interactive mode
-supports units (M and G)
-supports floating point partition sizes (ie. .5G=512M)
-automatic logging to /data/sdparted.log
##########################

requirements:
android phone with proper utilities(cm-recovery-1.4, amon_ra's recovery)
sdcard <--class 6 recommended(adata makes good ones...they max out the g1 hw in terms of speed)
adb
fingies

##########################

Code:
sdparted v0.6 created by 51dusty

if you use this script in your work, please give some credit. thanks.

requirements: cm-recovery-v1.4

usage: sdparted [options]


options:

 --fatsize|-fs SIZE[MG]     set the size of the fat32 partition to <SIZE>.
                            default=total sdcard size - (ext + swap)

 --extsize|-es SIZE[MG]     set the size of the ext partition to <SIZE>.
                            default=512M

 --swapsize|-ss SIZE[MG]    set the size of the swap partition to <SIZE>.
                            if set to 0, no swap partition will be created.
                            default=32M

 --extfs|-efs TYPE          set the filesystem of ext partition to <TYPE>.
                            valid types=ext2, ext3, ext4
                            default=ext2


 --upgradefs|-ufs TYPE      upgrades existing ext partition to <TYPE>.
                            this operation will NOT wipe your sdcard and
                            cannot be used with any partition creation options.
                            valid types=ext3, ext4

 --downgradefs|-dfs TYPE    downgrades existing ext partition to <TYPE>.
                            this operation will NOT wipe your sdcard and
                            cannot be used with any partition creation options.
                            valid types=ext2


 --interactive|-i           interactive mode

 --help|-h                  display this help

 --printonly|-po            display sdcard information

 --silent|-s                do not prompt user, not even initial warning.


examples:
 sdparted                     creates swap=32M ext2=512M fat32=remaining free space
 sdparted -efs ext4           creates swap=32M ext4=512M fat32=remaining free space
 sdparted -fs 1.5G -efs ext3  creates swap=32M ext3=512M fat32=1536M
 sdparted -es 256M -ss 0      creates no swap ext2=256M fat32=remaining free space
 sdparted -ufs ext4           upgrades ext partition to ext4
##########################

need to backup your ext partition?

the following commands will backup/restore your ext partition to/from a folder named sdbackup in your current directory. these must be run while phone is booted, not recovery.

to backup your ext partition: adb pull /system/sd/ %CD%\sdbackup
to restore back to sdcard: adb push %CD%\sdbackup /system/sd


##########################

to run from computer:
1. download sdparted.txt below to computer
2. connect g1 via usb
3. boot into cm-recovery-v1.4, goto console(alt-x)
4. at your windows cmd prompt type: adb push /path-to/sdparted.txt /sbin/sdparted
5. then type: adb shell chmod 755 /sbin/sdparted
6. to run type adb shell and hit enter.
7. you can now run script (ie. sdparted -efs ext4).
to run w/o computer:
1. download sdparted.txt below to root of sdcard. (get downloadcrutch if needed*thnx lycoln)
2. boot into cm-recovery-v1.4, goto console(alt-x)
3. at # prompt type: mount /sdcard
4. then, mv /sdcard/sdparted.txt /sbin/sdparted
5. then, chmod 755 /sbin/sdparted
6. you can now run script (ie. sdparted -efs ext4).
you CANNOT run this script from terminal app.


##########################

if the script crashes or you receive an error:

immediately pull the log to your computer(using adb pull /data/sdparted.log sdparted.log), b/c the log will not be there after a reboot. send me the log when reporting errors, please.


##########################

changelog:

changes in v0.6
*new feature=interactive mode
*tweak user abort function for those with itchy fingers

changes in v0.5.3
*remove initial warning(kinda pointless if there is another before you wipe)
*clean partition table handling code
*general code cleanup/consolidation in anticipation of new features

changes in v0.5.2
*handling of "partition 1 may not be aligned to cylinder boundaries", fixing "sh: -gt: argument expected" and related phenomena (ie. sdparted trying to partition using negative numbers ) reported by midtoad

changes in v0.5.1
*slight change to logging(so slight it only gets a .1), fixing "/sbin/sdparted: line 5: .//sbin/sdparted: not found"

changes in v0.5
*new feature=floating point partition sizes
*new feature=downgrade ext filesystem (ext3->ext2 ONLY, for now)
*fix some crappy programming

changes in v0.4
*unmount all partitions before operations, fixing "Error: Partition(s) on /dev/block/mmcblk0 are being used".
*remove some useless code

changes in v0.3
*new feature=logging
*new feature=units
*new feature=print card info

changes in v0.2
*add cm-r-v1.4 check to prevent running in 1.3.1

##########################

todo items:
-downgradefs support for ext4

##########################
Attached Files
File Type: txt sdparted.txt - [Click for QR Code] (15.7 KB, 13560 views)
Last edited by 51dusty; 26th February 2010 at 06:46 PM. Reason: update amon_ra url, requirements
The Following 4 Users Say Thank You to 51dusty For This Useful Post: [ View ]
3rd August 2009, 10:01 PM   |  #2  
Junior Member
Thanks Meter: 4
 
21 posts
Join Date:Joined: Jul 2009
Excellent!

One of the easiest things Ive done in a while. Worked great!
3rd August 2009, 11:27 PM   |  #3  
SyXbiT's Avatar
Senior Member
Thanks Meter: 2
 
122 posts
Join Date:Joined: Aug 2007
More
great.
i'm new to android, so i have a question.
I'm guessing when you go to settings and eject SD card, it only unmounts the FAT32 partition, right?
So does that mean the only safe way to eject the card is shutting down?

great job!
4th August 2009, 12:58 AM   |  #4  
Chahk's Avatar
Senior Member
Flag New York
Thanks Meter: 165
 
1,264 posts
Join Date:Joined: Apr 2009
More
Quote:
Originally Posted by SyXbiT

great.
i'm new to android, so i have a question.
I'm guessing when you go to settings and eject SD card, it only unmounts the FAT32 partition, right?
So does that mean the only safe way to eject the card is shutting down?

great job!

That depends which ROM you are running and how it's set up. CyanogenMod for example, will automatically use the Ext partition for Apps-to-SD if it finds one. Ejecting a card while the phone is using it as part of its internal memory would be a Bad Thing™.

If you are running the stock firmware, it would be safe to remove the card after ejecting it in settings.
4th August 2009, 02:21 AM   |  #5  
htcclay's Avatar
Recognized Developer
Flag Atlanta
Thanks Meter: 369
 
827 posts
Join Date:Joined: Sep 2008
More
Could anyone at their convenience post directions for using this with console,
and where to place text attached? Funny, I've done this the manual way but don't know the simple things.
Thanks in advance for your work and patience. =)
Last edited by htcclay; 4th August 2009 at 02:48 AM.
4th August 2009, 04:17 AM   |  #6  
oneG's Avatar
Member
Flag The Shadows
Thanks Meter: 0
 
94 posts
Join Date:Joined: Feb 2009
More
Figured this one out!
Last edited by oneG; 4th August 2009 at 05:05 AM. Reason: [SOLVED]
4th August 2009, 08:42 AM   |  #7  
sacredsoul's Avatar
Senior Member
Flag Singapore
Thanks Meter: 515
 
1,667 posts
Join Date:Joined: Feb 2007
More
Can you tell me how exactly to run this script? I ran this in recovery and i get sdparted not found.
4th August 2009, 01:39 PM   |  #8  
51dusty's Avatar
OP Senior Member
Flag bville, md
Thanks Meter: 12
 
144 posts
Join Date:Joined: Feb 2009
More
Quote:
Originally Posted by sacredsoul

Can you tell me how exactly to run this script? I ran this in recovery and i get sdparted not found.

where did you place the file? did you run chmod?
4th August 2009, 04:09 PM   |  #9  
Senior Member
Thanks Meter: 12
 
1,364 posts
Join Date:Joined: Mar 2009
excellent! Great job dusty
5th August 2009, 12:22 AM   |  #10  
Member
Thanks Meter: 0
 
78 posts
Join Date:Joined: Jul 2007
sacredsoul, Make sure you have the latest Cyanogen's Recovery Image, which I used 1.4. I got the same error using 1.31. I then updated to 1.4 and it worked perfectly. great Post 51dusty.

Post Reply Subscribe to Thread

Tags
ext4, parted, partition, script, swap
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes