possible to format linux-swap from existing fat32 partition - G1 Q&A, Help & Troubleshooting

I have a ext 2 and fat32 formatted card and I want to do linux-swap and I'm wondering if I can take my fat32 thats free and partition that as a linux-swap without formatting the fat32.

?
Most of the ROMs expect the partitions to be in the correct order so you would have to respect that anyway.
I'm guessing you want to reduce the size of the FAT partition without losing data to gain space to make a linux swap. In which case you can *in theory* do this in Ubuntu (from live CD). You would need to resize the FAT32 parition, move the ext2 partition to the left so the free space is at the end and create your swap partition there. I haven't tried it though and would want to backup anyway.

In my opinion you would get best results by start fresh on all the partitions. I would backup whats on your fat32 partition onto your computer and then use the directions for in this thread to create all three partitions.
Creating 3 fresh partitions with the directions in that threat eliminate and issues you may have with ROM's that might be cause from the partitions not being done right.

if you really want to do and do not care for your ext3 data (or just search how to back it up) you can go into recovery console for cm recovery image 1.3.1 or later do this
Code:
parted /dev/block/mmcblk0
rm 2
print
now take the space that is left say x amount of space
subtract y amount of space for linux-swap
then z will be amount of space left for ext2
x-y=z
now in parted type
Code:
mkpartfs primary ext2 [end of fat32 partition from print command above] [number of z from equation above]
then (so not to be too confusing)
Code:
mkpartfs primary linux-swap [z from above] [end of sdcard from print command by disk size dev/block/mmcblk0]
print (to verify it worked)
quit (ignore etc/fstab update)
upgrade_fs
reboot
or since this requires a fair amount of understanding of the process of using parted from the recovery image you may want to start from scratch

Related

sd card might be mad at me

Ok guys ima try to explain this as best I can. I have a 16g sd card that gparted or acronis will not recognize, now windows 7 on my laptop does.recognize it as an sd card showing 15.3gig wich I can only imagine is because it has been formated a few times, curently it has been formatted to fat32 using my laptop..what can I do to get my phone or any formatting tool to see it and format to the fat32, ext3 and linux swap, I've been trying for days and have read all I can so now I turn to the greater brains that be...thanks for ur help..........veritasaequita
I love the search button! Lol use cyanogen's latest recovery image (1.3.1) Search for it!
Then once you have it flashed, go into recovery console (alt+x on the menu) and type parted /dev/block/mmcblk0
do not type stuff in ( )
print (it should tell you the sector size, in mb. Since yours is 16gb it should be ~15000mb?)
rm 1
rm 2 (you might get, partition not found on this doesn't matter)
rm 3 (you might get, partition not found on this doesn't matter)
mkpartfs primary fat32 0 xxxx
mkpartfs primary ext2 xxxx yyyy
mkpartfs linux-swap yyyy zzzz
quit
upgrade_fs
reboot recovery
alt+f, alt+w, alt+s
home+back
<some extra notes, for the linux-swap partiton it should be roughly 32 mb. So make sure there's only a 32mb difference between yyyy and zzzz>
<ext2/3 partition should be ~600 mb> and fat32 the rest. Any problems just message me

How to partition the SD card for CyanogenMod

How to partition the SD card for CyanogenMod? make it into 2?
Here is a how to link http://forum.xda-developers.com/showthread.php?t=535232
yeah but the guide says to download a app for apps2sd and the thread for CyanogenMod says not too. Confused ;p
Read threw the whole thing, you will load apps2sd but then you will do a wipe and load cyangen again with apps2sd installed in the rom. The reason cyanogen says not to have apps2sd is because its already in the mod. So you will use it to partition then wipe it then reintall it with cyanogen
It helps to use the SEARCH
How to partition your SD card from console (This requires the cyanogen recovery 1.3.1)
Example for my 8GB card.
Reboot and enter recovery (home+power) then go to console. Enter the below pressing "enter" after each line.
parted /dev/block/mmcblk0
print (to verfiy we know what size card we are dealing with. Mine was 8166 read below if yours is different)
rm 1 (if you had more than 1 partition you would want to rm them as well)
mkpartfs primary fat32 0 7526
mkpartfs primary ext2 7526 8038
mkpartfs primary linux-swap 8038 8166
quit
upgrade_fs
recovery
if your card isn't 8166 when you type print then you will need to modify those numbers to match your card size. You basically work back to figure out the totals. To figure it out, start with your cards total size. For example 8166 total Subtract 128 for swap (8038) minus 512 for ext (7526) the rest will go to fat32. Each partition starts where the other left off.
http://forum.xda-developers.com/showthread.php?t=533731

swap file size

ok i have installed the ra recovery v1.2.3 from the dev forum and have partitioned my sd card usingthe utility that came with it.only thing is i still dont understand how to set the swap file size.can somebody please explain how.i have searched around already.this is a lot to take in.
You searched, but the post on partitioning your sd card is at the top of this section...
evilkorn said:
You searched, but the post on partitioning your sd card is at the top of this section...
Click to expand...
Click to collapse
yeah man i read. i dont want to have to download and install all those requirements listed.there has to be another way.also i did breeze through the thread and didnt see any mention on setting swap file size.
8255daw said:
yeah man i read. i dont want to have to download and install all those requirements listed.there has to be another way.also i did breeze through the thread and didnt see any mention on setting swap file size.
Click to expand...
Click to collapse
Umm... The swap file size is the same size as your linux-swap partition...
sorry for being such a noob.the utility that came with the ra recovery sets it automatic to 36mb.i dont see where i can change it.
To format card SD card with linux-swap WARNING!!! this will reformat you entire SD card!!
You can use the recovery console and parted to format SDcards with 1.31 folks, no more going through hassles you have the tools on you G1!...here is an example of how to do this in recovery console using parted. DO NOT USE MORE THAN 32MB SWAP!!!
Example for 8GB card (this example plays it safe and will leave a small amount leftover regardless of the 8GB card)
Reboot and enter recovery
Enter console
#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 7200
mkpartfs primary ext2 7200 7700
mkpartfs primary linux-swap 7700 7732
#print (to verify we have the 3 partitions)
Example for my 4GB card
#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 3420
mkpartfs primary ext2 3420 3932
mkpartfs primary linux-swap 3932-3964
Example for a 2GB card playing it safe
#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 1200
mkpartfs primary ext2 1200 1700
mkpartfs primary linux-swap 1700-1732
"End?" you need to place the last value for the linux swap eg.3964 for my 4GB card
#print (to verify we have the 3 partitions)
Next we need to "quit" parted and upgrade our ext2 partition to ext3
#upgrade_fs
Swap value is set to 30 currently, you can change this by modifying the "echo" value for swappiness in the a2sd.sh script
For a longer more detailed parted turorial read this
thank you sir...that is a thread i have read since joining here but i have not stumbled across it since.thanks again.
Its under JACHero ROM thread fyi.

[Noob Question] This might sound a bit silly . . .

Ive got a rooted G1 and im running CyanongenMod 4.2.3.1 Ive got a 16gb class2 sd card and ive partitioned it it it with 14.5gb - Fat32 and 1gb ext2
Now i know thats not right and so i wanna fix it. What i really wanna do is :
a) Have all the partitions set at correct sizes
b) a swap partition
c) and an upgrade to ext3 or 4 whichever is better
As ive already got about 200 apps installed whats the best ways of backing them up and doing the above
Thanks in Advance
Thru console:
parted /dev/block/mmcblk0
print (verify what size your card is)
rm 1
mkpartfs primary fat32 0 15500
mkpartfs primary ext2 15500 15852
mkpartfs primary linux-swap 15852 15948
quit
upgrade_fs
reboot recovery
May want to reformat to fresh fat32 beforehand but up to you.The sizes above can vary depending on what size your card is but that is a base for 16gb and includes a 96mb swap. Press enter after each line.
Tons of ways to backup...on your PC or I use Astro to do so...but any file manager works
http://forum.xda-developers.com/showthread.php?t=534714
I have that lovely little tutorial bookmarked, I use it almost everyday ( I flash new roms and stuff everyday, I just don't know what to settle on )

Deleting Partition?

How do I do this? I wanna wipe everything and make a new partition with a different amt of swap, etc. How do I go about doing this?
go to recovery and re particion your sd card. but remember to back up stuff to your pc that are important.
Sent from my Htcclay's SuperBad G1 using the XDA mobile application powered by Tapatalk
phazzdaddy said:
How do I do this? I wanna wipe everything and make a new partition with a different amt of swap, etc. How do I go about doing this?
Click to expand...
Click to collapse
Follow these steps. I do them every single time before flashing a ROM, never have any issues that others have because they are lazy and refuse to just start fresh. I'm going to make this as basic as possible just to make it easy. It looks long, but I can seriously do this in under 3 minutes now.
You can either remove everything off your SD card and transfer on later, or leave it. It depends on if you want to resize your fat32 partition.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you don't have Amon_RA's recover get it Here
Boot into recovery (power on phone by pressing home button and power button)
Once in recovery, select (Go to console)
Press Enter
at the /# type this in
parted /dev/block/mmcblk0
Press Enter
When this pops up (parted), type in print
Press Enter
You should now see something like this:
Code:
Model: ([B][COLOR="Red"]whatever model your SD is[/COLOR][/B])
Disk /dev/block/mmcblk0: ([B][COLOR="Red"]the size of your SD card (write this # down for reference)[/COLOR][/B])
Sector Size (logical/physical): ([B][COLOR="Red"]Sector size[/COLOR][/B])
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 7405MB 7405MB primary fat32 lba
2 7405MB 7905MB 500MB primary ext2
3 7905MB 8001MB 96.0MB primary linux-swap(v1)
This gives you a break down of how much space is allocated for each partition.
The start/end/size values will differ depending on the size of your SD card and partitions.
Write down the size of your sd card, you can find it above next to:
Disk /dev/block/mmcblk0: ####MB
From here you can now delete and resize your partitions.
Number:
1 - fat32 partition (where you store music, photos, etc.)
2 - ext partition (where apps2sd goes)
3 - swap partition (used for swap)
Before you start deleting, make sure if you do want to remove the fat32 partition, you mount your SD and copy everything to your PC or wherever so you can transfer back later.
To remove individual partitions, type in at the (parted)
rm 1 Enter (this will delete your fat32 partition)
rm 2 Enter (this will delete your ext partition)
rm 3 Enter (this will delete your linux-swap partition)
Depending on what you deleted, you can type print Enter, again and it will refresh the partitions.
Using the number you wrote down which is the size of your SD card, you can figure out how you want to allocate the partitions.
I will show you what I type in and you can go off of that.
I have a 8GB SD card. 8169MB total
7405MB - fat32
500MB - ext2
96MB - swap
I only use 8001MB just to be safe. (not sure if it matters)
You just don't want to go over your SD card size.
Now to create the partitions.
The sizes below are my settings.
You can decide the sizes for you own SD card.
--------------------------------------------------------------------------------
For fat32 type in at the (parted):
mkpartfs primary fat32 0 7405 press Enter
This will create a 7405MB fat32 partition
--------------------------------------------------------------------------------
For ext2 type in at the (parted):
mkpartfs primary ext2 7405 7905 press Enter
This will create a 500MB ext2 partition
--------------------------------------------------------------------------------
For swap partition type in at the (parted):
mkpartfs primary linux-swap 7905 8001 press Enter
This will create a 96MB swap partition (you can upgrade to ext3 and ext 4 through the recovery)
--------------------------------------------------------------------------------
Notice the numbers I entered in 0 7405 (since 0-7405 = 7405, that's the size of the partition. Yes elementary, but just so you know what the numbers represent)
7405 7905 (7905-7405 = 500, 500MB partition, and so on)
You can choose whatever you want for the sizes of the partition doing it this way. Just make sure fat32 partition starts with 0, you want fat32 partition first, ext 2nd, and swap 3rd.
Once you have created the partitions, reboot into recovery and flash your rom.
To reboot into recovery, type quit at the (parted)
Then reboot recovery at the / #
It may look hard, but it is really simple.
Good luck.
All the credit for this goes to 51dusty and his thread Here
I just made this so you can do the same steps from your phone.

Categories

Resources