I'm posting this because I am seeing lots of confusion in this area.
Most of the guides found on this forum as well as answers given in the q/a section pertaining to this give the following advice for formatting/wiping a ext parition:
Code:
rm -rf /system/sd/*
Although this may fix a lot of problems it does not really reformat the partion.
"rm -rf" just means "remove(delete) --recursively(subfolders as well) --force(don't ask if ok)". This only deletes the files by removing the inode entries from the filesystem table.
To truly reformat and ensure there are no remnants on the partition you need to make a new filesystem on that partition. This will build a new inode table completely instead of just removing entries in the table.
Enter recovery console (filesystem should NOT be mounted when formatted)
Code:
mke2fs /dev/block/mmcblk0p2 #for ext2 partitions
mke2fs -j /dev/block/mmcblk0p2 #for ext3 partitions
"mke2f2" means "make extended2 filesystem"
"-j" means "add a journal"(ext2+journal=ext3)
Hope this helps
Printing this out right now this is a keeper
Thankyou
Thanks buddy...printing now...
Ok, even though I am just begining at Linux I do understand the difference here between the 2 methods (its like the quick format option under windows). My question is, does it matter? Can you explain why the quick method may be detramental or unsafe.
Thanks for the advice dumfuq, but what if you have a ext4 partition?
Total Noob:
I've just been removing the partition and creating a new one.. is that just as effective (obviously the longer route)?
Also, how would you go about reformatting a linux-swap partition? Again, I've just been removing and recreating every time I flash.. I realize this isn't the fastest way.
Thanks a lot. This is very helpful.
Baldyman1966 said:
Ok, even though I am just begining at Linux I do understand the difference here between the 2 methods (its like the quick format option under windows). My question is, does it matter? Can you explain why the quick method may be detramental or unsafe.
Click to expand...
Click to collapse
I don't think just deleting the files is detrimental or unsafe...its just not formatting. For the most part it doesn't matter but if you want a fresh filesystem make a new one.
Thanks for the advice dumfuq, but what if you have a ext4 partition?
Click to expand...
Click to collapse
It should be
Code:
mke2fs -T ext4 /dev/block/mmcblk0p2
But I haven't tried it
I've just been removing the partition and creating a new one.. is that just as effective (obviously the longer route)? Also, how would you go about reformatting a linux-swap partition? Again, I've just been removing and recreating every time I flash.. I realize this isn't the fastest way
Click to expand...
Click to collapse
Yup...just as effective.
For swap
Code:
mkswap /dev/block/mmcblk0p3
But I don't think it is usually necessary to remake the swap after the initial creation (could be wrong on that though and I guess it can't really hurt)
This thread should be listed in the "Informative Links" sticky
simliarly, how would you go about removing the entire ext3 partition, so reclaim that 500mb back into the fat32? i have a htc magic and no longer need apps2sd, so having a ext partition isnt neccesary in my case. i rather use that extra 500mb for media and storage.
is there a special command to do this? i dont want to reformat the entire card since i have a lot of stuff on my fat32. i was hoping there was an easy way. thanks for any advice!
NguyenHuu said:
simliarly, how would you go about removing the entire ext3 partition, so reclaim that 500mb back into the fat32? i have a htc magic and no longer need apps2sd, so having a ext partition isnt neccesary in my case. i rather use that extra 500mb for media and storage.
is there a special command to do this? i dont want to reformat the entire card since i have a lot of stuff on my fat32. i was hoping there was an easy way. thanks for any advice!
Click to expand...
Click to collapse
Not really.
To do this you have to modify the partition table. Personally I would just back up the data, use fdisk (available in recovery console) to delete old and create new partitions, use windows to format the new fat32 partition created with fdisk, and then restore the data.
However since you don't want to reformat, you could try using gparted(or even parted for that matter) to remove the ext3 partition and resize the fat32. Still probably want to backup first though. There are a few tutorials already that walk you through adding an ext3 partition without losing your fat32. It shouldn't be to hard to follow one of them and tweak the commands to remove ext3 and expand the fat32.
thanks for all the advice, i have removed the ext partitions and resize my fat32 successful without data lost. i backed up just in case too. thanks.
Related
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
I tried using MiniTool Partition Wizard to format my android sd card, I split the first half to be fat32 and the second half to be ext4, when I do that though the ext4 partition doesn't stay... I even tried twrp to partition it, to no avail it said it wasn't able to create the ext4 partition but the fat32 partition was made successfully.
**NOTE**
Apparently, you need a swap partition to be able to have ext4? Well, I created one and now everything works fine and dandy, before I didn't have one and it worked great...
You dont need swap for ext partitions.. there is no connection between them.
I dont know much about those tools but if you create partition through recovery.. first it makes ext2 partition later you need to upgrade it to ext4.
rr0yy said:
You dont need swap for ext partitions.. there is no connection between them.
I dont know much about those tools but if you create partition through recovery.. first it makes ext2 partition later you need to upgrade it to ext4.
Click to expand...
Click to collapse
If I could post link I would, but since I cannot mostly because to the site I'm not a developer (stupid rules) and claims I cannot post anything truly helpful, so as an effect cannot post links to my recovery.
My recovery (ZenGarden 2.0.2.7-T) can create an ext2, ext3 and ext4 partition; the use chooses which format and because of Windows limitations you cannot have more then two partitions on an external drive.
Hey guys
Recently I've got a ZTE V970M (MT6577) phone and so far it's awesome. However, some people have been asking for a way to extend the /data partition because some games are heavy 'n stuff. That's alright.
There is a method which resizes the partitions by altering the MBR on the EMMC and that way the /data partition ends up with 2GB (from [email protected]) + 512MB (the assigned for /data), but I want to do something different, without having to edit the MBR that way. Dunno, it's fishy imo.
My idea was to format [email protected] (which comes in vfat) as ext4 and then editing init.rc and change the partition mount points from [email protected] to [email protected]
If I do that without formatting, the phone boots but it asks for an encryption key. Reading on the net, it's not asking for an encryption key, it's the fallback mode for when it can't mount the /data partition and then it believes it's encrypted, but it isn't.
If I format the [email protected] to ext4 (mke2fs -T ext4 /dev/block/mmcblk0p6), parted shows it's on ext4 and all that shiz, but the phone seems to disconnect itself from ADB once it finishes booting, and hangs in bootloop. Since I can't ADB it, I don't know wtf is going on with the phone. Something tells me I'm close to reaching the goal though.
Looking on the net I found this useful link -> http://blog.kangkang.org/index.php/archives/242 which talks about extending /data the way I want to do (for the Tegra2 one, but it shouldn't matter). However, Chinese isn't my main or secondary language (lol) and google translate does an horrible job at translating it.
So, anyone got ideas on how to extend such partition? I just want to swap the normal /data partition with the internal SDcard partition, so in theory if I format it to ext4 and swap the mount points it should work, it's just a swap, but why it isn't?
Any ideas are greatly appreciated!
Thanks in advance!
- DARKGuy
I hate bumping but, nobody yet? I've seen this being done in other phones... any ideas?
I can't believe no one has an idea yet... come on, this is XDA... wtf is up?
Yeah, I wanna know this too. If formatting the EMMC on my Note1 to anything other that the FAT32 will help?
the g330 comes with a reasonable storage. But there is not enough space for apps on /data. The internal sd-card got a lot of space. resizing /data (part. 18) may be critical and requires another recovery image. So my idea is to log in the phone, start fdisk /dev/block/mmcblk0, delete internal sd-card partition (19), then create a e.g. 1 GB partition with ext4, which I will mount on /data/app, and give the rest to a new partition 20 for internal sd-card.
I think this approach is more fail-save and can be done quite fast. I have to change just init.rc to add one mount and vold.fstab. Has somebody tried this?
yes, i know, the dalvik-cache and /data/data will still load the /data partition, and app2sd would save the same space from /data. But app2sd needs one mount for each app (at least in GB), so booting takes very long time and I have to wait until I can launch an app.
I read sometimes, the kernel get the offsets of the partitions of flash as parameters when booted - so some offsets would be wrong when I change the partion table. This would cause to fail mount /data/app - what about this?
rregn said:
the g330 comes with a reasonable storage. But there is not enough space for apps on /data. The internal sd-card got a lot of space. resizing /data (part. 18) may be critical and requires another recovery image. So my idea is to log in the phone, start fdisk /dev/block/mmcblk0, delete internal sd-card partition (19), then create a e.g. 1 GB partition with ext4, which I will mount on /data/app, and give the rest to a new partition 20 for internal sd-card.
I think this approach is more fail-save and can be done quite fast. I have to change just init.rc to add one mount and vold.fstab. Has somebody tried this?
yes, i know, the dalvik-cache and /data/data will still load the /data partition, and app2sd would save the same space from /data. But app2sd needs one mount for each app (at least in GB), so booting takes very long time and I have to wait until I can launch an app.
I read sometimes, the kernel get the offsets of the partitions of flash as parameters when booted - so some offsets would be wrong when I change the partion table. This would cause to fail mount /data/app - what about this?
Click to expand...
Click to collapse
I tried this and it works
its for g300 but it works on g330
http://www.htcmania.com/showthread.php?t=428466
sorry, its in spanish haha use the google tranlator
xals1997 said:
I tried this and it works
its for g300 but it works on g330
http://www.htcmania.com/showthread.php?t=428466
sorry, its in spanish haha use the google tranlator
Click to expand...
Click to collapse
Did i get the idea? You use link2SD (from Bülent Akpinar) , but instead of using a 2nd partition of the external SD-card with ext2, you use the internal SD-card for link2SD?
But i heard that link2SD need a ext2/3 partition? Also, in my version of link2SD there is:
mount -t ext2 -o rw /dev/block/vold/179:2 ...
btw. how is /system/etc/install-recovery.sh triggered
I've been trying to partition my SD card, but all steps I take to try and diagnose why I am unable to partition the card is getting me nowhere.
Initially, I used gparted on my laptop to partition the SD card with a v-fat partition and a f2fs partition, both primary partitiond. This was when I found out that no matter what I do the second partition on the SD card, it doesn't seem like the format actually takes. Whatever tool I use complete the partitioning and formatting steps successfully by all appearances but it doesn't seem like the partition is ever actually formatted. What I mean by that is that no matter what the second partition is it never mounts. I get an invalid argument error or bad super blocks and so forth. I can make the first partition anything I want: fat, v-fat, f2fs, ext4 and so forth and that will mount in my terminal without issue, but no matter what I do the 2nd partition always fails to mount. I've also noticed that blkid never has any fs info for the second partition. It gives me the partition UUID and that's all, while the first partition has both part UUID & fs UUID.
I've even gone so far as to just recently get a brand new SD card thinking that perhaps the first SD card was corrupted but I'm still getting the exact same behavior. Also of note is that in gparted when I try to create a secondary partition, I'm unable to mount the second partition so I don't think it has anything to do with my device. I've tried using fdisk, gdisk, parted in the terminal and I've tried using extended partitions and logical partitions and only primary partitions. I've done this before in the past so I know that it is possible.
It almost seems like the SD cards that I have are simply not capable of being partitioned in any way but it's strange that I now have two 512 GB SD cards and they're both giving the exact same behavior so I'm thinking that I'm missing something obvious. Any help anyone could provide as far as trying to figure this out or debug what's going on what I'm doing wrong would be greatly appreciated.
Thanks,
Ryan
only the first partition is mounted from vold. that is normal behaviour on every device. if you want have all partitions mounted automatically install LineageOS.
furthermore, although sdcardfs supports ext4, f2fs, for file transfer via USB MTP afaik fat32, exfat or ntfs is required.
what do you need f2fs partition for? maybe I can point you to workaround.
aIecxs said:
only the first partition is mounted from vold. that is normal behaviour on every device. if you want have all partitions mounted automatically install LineageOS.
furthermore, although sdcardfs supports ext4, f2fs, for file transfer via USB MTP afaik fat32, exfat or ntfs is required.
what do you need f2fs partition for? maybe I can point you to workaround.
Click to expand...
Click to collapse
I don't need anything to mount automatically. I'm saying I can't manually mount these partitions. I also don't need f2fs, that was just an example. I've tried multiple partitions that are just fat, ext4 and many other combinations. Under no partition scheme can I get anything other than the first partition to mount--using the mount command as root.
can you please try gdisk binary from here
https://forum.xda-developers.com/t/...-on-qmobile-z8-with-bricked-dead-emmc.3712171
please post the result of partitioning and formatting.
if you're interested in alternative solution, you can actually format the whole MicroSD card as exfat, and create ext4 partition image on top as regular file. I have done that for my mothers Huawei for Link2SD because it doesn't support adoptable storage.
aIecxs said:
can you please try gdisk binary from here
https://forum.xda-developers.com/t/...-on-qmobile-z8-with-bricked-dead-emmc.3712171
please post the result of partitioning and formatting.
if you're interested in alternative solution, you can actually format the whole MicroSD card as exfat, and create ext4 partition image on top as regular file. I have done that for my mothers Huawei for Link2SD because it doesn't support adoptable storage.
Click to expand...
Click to collapse
I have tried with gdisk but I can try with that specific version and report back. I understand we can create imaged file systems, but one of the main reasons I do this is that I find fat partitions are fickle and can easily be corrupted where the whole partition requires wiped. By having a non fat partition I use that as a better backup option where I find it's easier to recover data in case of corruption or other issues. For such use, being tied to the fat FS would still incur the possibility of data loss so that doesn't work for my purpose.
Thanks and I'll report back,
Ryan
oh I wouldn't rely on f2fs for backups it still has bugs and there are no recovery tools for f2fs
https://forum.xda-developers.com/t/4550931
https://android.stackexchange.com/q/250389
alecxs said:
oh I wouldn't rely on f2fs for backups it still has bugs and there are no recovery tools for f2fs
https://forum.xda-developers.com/t/4550931
https://android.stackexchange.com/q/250389
Click to expand...
Click to collapse
Thanks for the suggestion to use gdisk. I downloaded the version you linked, but I still get the same behavior. I believe it is related to the fact that only the first partition gets a filesystem UUID in blkid. I'm not sure what this means, but it seems clear that the second filesystem isn't being properly created no matter what I do.
that's strange, especially the fact you tried on PC too. on the phone, can you create partitions inside a blank disk image just for double check to rule out kernel issue?
I'll give that a try and report back
alecxs said:
that's strange, especially the fact you tried on PC too. on the phone, can you create partitions inside a blank disk image just for double check to rule out kernel issue?
Click to expand...
Click to collapse
Yeah I'm able to create an image, partition it into a vfat & ext4, then mount both of those partitions.
can you dd the file into mmcblk1 for testing purposes?
alecxs said:
can you dd the file into mmcblk1 for testing purposes?
Click to expand...
Click to collapse
Sorry this isn't clear to me. What am I using to dd into the partition, and do you mean mmcblk1p1/2? As mmcblk1 is the whole disk.
Thanks,
Ryan
yes, I meant the whole disk you created a test file that contains MBR or GPT and two partitions including UUIDs and file systems? If you dd it into the mmcblk1 it should create 1:1 copy of that disk image with two partitions including partition table.
Well I'll be:
Code:
/dev/block/mmcblk1p2 on /data/data/com.termux/files/home/i2 type ext4 (rw,relatime,seclabel) /dev/block/mmcblk1p1 on /data/data/com.termux/files/home/i2 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
Code:
/dev/block/mmcblk1p2 23M 46K 23M 1% /data/data/com.termux/files/home/i2 /dev/block/mmcblk1p1 4.9M 0 4.9M 0% /data/data/com.termux/files/home/i1
I can possibly use gparted to just resize those! Any thoughts on what was going on, why this method worked? Hrmm looks like resizing fat could be a challenge, but this certainly gets me closer!
there is also parted binary you can use on phone
I have it and I'm playing around with it, thanks for all your help