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
Related
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.
Attempting to partition sd card with ext4 -a process I completed multiple times successfully on a Nexus One, the process appeared to complete but now the phone will not mount the sd card. I've tried a wipe/reset, to no avail. I can still access and partition the sd card through adb, but the phone cannot mount it to format/partition, restore from recovery, partition sd-card from within ClockWork Recovery, nothing. I've re-partitioned the sd card through adb, which indicated a successful completion, but the phone still refuses to mount the sd card. If this weren't a Nexus S with it's cursed internal sd-card I would simply swap out the sd card with another or format it externally like all the google topics I pull up on the subject suggest.
Is this fixable or has the fused sd-card scenario become a liability?
Common Error messages:
Can't mount /sdcard
Can't mount /sdcard/.android_secure
Phone: Nexus S (US, T-Mobile, manufactured Dec. '10)
Recovery Img: ClockworkMod Recovery 3.0.2.4
Rom: CM 7.0.3 (now wiped, cannot put back on since sd card won't mount)
fstab:
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/platform/s3c-sdhci.0/by-name/userdata /data ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
Can mount everything except the last one, /sdcard.
I've tried all the recommended procedures garnered from the first 10 or so pages in google, xda, cyanogem forum, etc:
Restore from nandroid: Not possible, can't mount the SD,
Wipe/Reset: can't wipe /media as sd card won't mount,
partition sd card from within Clockwork: indicates success but does nothing,
format from within clockwork: unable to mount,
repartition using adb: works, parted can see them, I can move files to from, but the phone will not mount,
clearing fstab: no effect,
Fastboot works, but I don't have the proper images. ADB works, as do the installed utilities. Have not tried ODIN as again, I don't have the proper images. Should I attempt to compile my own images from source?
Update: SOLVED, Microsoft Windows. To whom it may concern: I was able to mount the /dev/block/platform/s3c-sdhci.0/by-name/media from two different laptops running OSX and Fedora/Ubuntu then successfully been able to partition them with fat32 as the ClockworkMod (and maybe Cyanogen?) expect with 0 progress. Then I pulled out an old Windows machine, installed the JDK/ADK's +tools and performed the same procedure and that time it worked. I'm uncertain as to what particular quality a 'genuine' Windows formatting provides, but either this phone or the particular software combination I'm running require it. I was able to mount & re-partition the /sdcard in Clockwork, then manually remove rebuild them and upgrade to ext4 using tune2fs as usual. In the interim for work and such, I had to find a surrogate (for the SIM) and could only find and old k750i (which still had a full charge and worked flawlessly all day, btw). Wow phones used to be small.
I think I was missing something about the way ClockworkMod handles fstab, because everytime I would modify it specifically to the specs I passed to parted while creating the partitions with mkpartfs, it would either ignore or overwrite them. So be careful messing with the sd-card, the S's aren't like the One's in the sense that if you screw it (the sd-card) up or it goes bad you can't just take it out and format it in another machine/phone, you have to appeal to ClockworkMod. ODIN $ucks by the way, I found fastboot to be much more effective.
If you format the sd partition ext4, then you should change the fstab too.
from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
to from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard ext4 rw
or from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard auto rw
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Of course, I don't know, whether the recovery has the vfat type in fstab. You might have to change it there too. On my linux box auto works very well in fstab.
Of course, if you partition your sd partition ext4, you won't be able to use it as usb memory from windows. (At least I am pretty sure you can't, haven't tried)
Well of course I couldn't let it die, I went back and started tinkering again now that I have a way back. I can't change the fstab it seems, whatever I change it to gets over written everytime either Clockwork or the Rom starts. It's weird, I know I'm missing something and I don't know much about CWMod. (had Amon_Ra on the N1, which had the nifty fsupgrade script)
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Click to expand...
Click to collapse
I'm quite familiar with unix style fs and fstab, it's the stubbornness I'm not used to. I'm also spoiled by vi and nano. CW has some nice scripts built in as well though.
Hello!
My problem basically is that i can't use Link2sd - i'm currently running the latest CronosX mod - because it can't create the mount scripts. I keep getting the following error:
mount: mounting /dev/block/vold/179:2 on /data/sdext2 failed: device or resource busy
i have a trascend class 10 8gb SD, i have a 6,5 gb Fat partition and the rest is EXT2 (now). I formatted it with minitool partition magic.
I have googled the problem for days now, seems i found nothing useful..
so far i tried:
ext3, ext4 -- then still couldn't create mount scripts, but i also had the following error msg in OR:
"can't mount /dev/block/mmcblk0p2 (invalid argument)"
although in SD utilities when checking the ext partition it recognised as EXT4 or EXT3..
with ext2 it seems working as of i don't see that msg..
still no link2sd. I read in the mod's forum that the app is supported, so it can't be the problem.. or is it?
Same issue, resoved by using FAT32
I had the exact same issue you're having. I tried using EXT2,EXT3, and EXT4 but couldn't get it to work. I finally got it working by using a FAT32 partition.
I know this may sound a bit dumb (like myself in android technicals) but
1. Do you have the specific kernel modules loaded to recognize these filesystems?
2. Are the devices attached to the PC with memory card access? [should not be].
3. Maybe you should try partitioning with a linux distro or some specific tool (might want to check out some instructions.
I am operating Link2SD with a fat16/32 partition (I don't know which )
I have same problem does someone solved it ?
i had no solutions whatsoever.. currently i'm using the mod's built in app2ext
i made an ext2 partition which i transformed into ext3 with openrecovery.. now i have an app folder which is automatically used to store my apps.
no link2sd for me anymore :\
although i have some other issues for i'm about to open a new thread
I found the solution : http://forum.xda-developers.com/showthread.php?t=1713478
linksd mount solved
with the phone plugged in to pc/mass storage i formatted the ext2 partition again. in link2sd mount in ext4.
cwkhong said:
with the phone plugged in to pc/mass storage i formatted the ext2 partition again. in link2sd mount in ext4.
Click to expand...
Click to collapse
Mount as ext4 is not a problem. It should work.
Sent from my XT720 using xda app-developers app
how you can solve this problem, is to make the second partition a active partitons with MiniTool Partition.
When de second disk is a active partition it wil boot before the boot of the system.
reply post ext 4
bSptya said:
Hello!
My problem basically is that i can't use Link2sd - i'm currently running the latest CronosX mod - because it can't create the mount scripts. I keep getting the following error:
mount: mounting /dev/block/vold/179:2 on /data/sdext2 failed: device or resource busy
i have a trascend class 10 8gb SD, i have a 6,5 gb Fat partition and the rest is EXT2 (now). I formatted it with minitool partition magic.
I have googled the problem for days now, seems i found nothing useful..
so far i tried:
ext3, ext4 -- then still couldn't create mount scripts, but i also had the following error msg in OR:
"can't mount /dev/block/mmcblk0p2 (invalid argument)"
although in SD utilities when checking the ext partition it recognised as EXT4 or EXT3..
with ext2 it seems working as of i don't see that msg..
still no link2sd. I read in the mod's forum that the app is supported, so it can't be the problem.. or is it?
Click to expand...
Click to collapse
you must re-partition your sd card, BUT, just do it for your sd-ext only:
with Partition magic
1. delete your sd-ext partition (JUST YOUR SD-EXT PARTITION)
2. create partition
3. set as Primary
4. and CHOOSE ext4!!,
5. ok and then,
6. Apply
I hope this will help you..:good:
bSptya said:
Hello!
My problem basically is that i can't use Link2sd - i'm currently running the latest CronosX mod - because it can't create the mount scripts. I keep getting the following error:
mount: mounting /dev/block/vold/179:2 on /data/sdext2 failed: device or resource busy
i have a trascend class 10 8gb SD, i have a 6,5 gb Fat partition and the rest is EXT2 (now). I formatted it with minitool partition magic.
I have googled the problem for days now, seems i found nothing useful..
so far i tried:
ext3, ext4 -- then still couldn't create mount scripts, but i also had the following error msg in OR:
"can't mount /dev/block/mmcblk0p2 (invalid argument)"
although in SD utilities when checking the ext partition it recognised as EXT4 or EXT3..
with ext2 it seems working as of i don't see that msg..
still no link2sd. I read in the mod's forum that the app is supported, so it can't be the problem.. or is it?
Click to expand...
Click to collapse
I had the seem problem and I solved creating 3 partitions. The first is not utilized but it must be create because as the Link2Sd as the AndroidOS search the data partition in the second (or last for AndroidOS) partition. I have created the first more small as Linux Swap, the second in ext2 fot Link2SD and the third in Fat32 for SD-Ext Data.
So the App works fine.
Sorry for my English.
Much Appreciated
thenotec said:
I had the seem problem and I solved creating 3 partitions. The first is not utilized but it must be create because as the Link2Sd as the AndroidOS search the data partition in the second (or last for AndroidOS) partition. I have created the first more small as Linux Swap, the second in ext2 fot Link2SD and the third in Fat32 for SD-Ext Data.
So the App works fine.
Sorry for my English.
Click to expand...
Click to collapse
No apologies necessary, i believe you were clear enough, well what do you know i must say inverting the order does seem to work
1. swap 2. Ext and 3. Fat/ Fat32
yabubonnah said:
No apologies necessary, i believe you were clear enough, well what do you know i must say inverting the order does seem to work
1. swap 2. Ext and 3. Fat/ Fat32
Click to expand...
Click to collapse
if i do that then i cant connect my usb storage to my PC, cuz if you create partitions with minitool, only the first partition is read as usb storage, so if you make the first part e.g. a swap file, then PC wont see your usb storage when plugged in via usb... and in minitool i see all partitions without drive letters, just .* sign after i format and create partitions.... and nothing helped me with mount script error either...
link2sd mount script error resolved
cwkhong said:
with the phone plugged in to pc/mass storage i formatted the ext2 partition again. in link2sd mount in ext4.
Click to expand...
Click to collapse
sir tnx for this info... error already resolved... thanks again so much...
Connect Phone to PC in Mass Storage Mode
Open MiniPartition Tool
Format the 2nd Parition as EXT4
Disconnect the Phone
Open Link2SD and you will see acript created and mounted already (for apps in SD card)
easy solution work for me ;D
after create partition ext 3 , just go to root file manager and change system file from read only RO to read write RW and recreate mount script on link2sd . hope it works happy new year!
NaraRockingMyAce said:
you must re-partition your sd card, BUT, just do it for your sd-ext only:
with Partition magic
1. delete your sd-ext partition (JUST YOUR SD-EXT PARTITION)
2. create partition
3. set as Primary
4. and CHOOSE ext4!!,
5. ok and then,
6. Apply
I hope this will help you..:good:
Click to expand...
Click to collapse
I had the same problem and had been looking for a solution until I found your help. Just want to thank you for this. It helped a lot! Fixed my problem :good:
Hi, I have a same problem.
But before I repartition the ext2 how can I save the content? My previlus installed apps will not work, I think in this case.
final solution
backup your sdcard and format it
recreat 2nd partition ex4
congratulation :good:
Solved!
Zachary57 said:
I found the solution : http://forum.xda-developers.com/showthread.php?t=1713478
Click to expand...
Click to collapse
Zachary had the solution for me! Just convert link2sd to system app (function of link2sd, after that my phone crashed and restarted) and clear the ext3 or ext4 partition (or reformat). I used Minitool Partition Wizard under windows. Don't forget to select primary partition!
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.
This is a very annoying issue but I have not found any thread about it.
I'm trying to upgrade my external/removable sdcard for an android 6 device.
The new sdcard gets mounted to /mnt/media_rw/XXXX-XXXX (i.e. not 0123-4567), so no app works as files can't be found.
The linux way (ln) wont work. Simply creating /mnt/media/0123-4567 causes bad bootloop on my device. This suggests that FolderMount app or Magisk modules such as fbind are a bad idea. selinux is enforcing.
It appears that Android assigns different mount points are to different sdcards and the first sdcard always gets 0123-4567. It that's right, Android probably stores sdcards' identifiers so as to know which mount point to use at boot time. So, deleting the identifiers database would probably mean that the next card inserted would get 0123-4567 as mount point.
I have looked at the data of com.android.externalstorage, but there is nothing there. I don't see other obvious candidate apps.
Where is this ext sdcard data stored?
I was wrong. Android sets mount points matching sdcard uuid
How to change vfat partition UUID?
How do I change the UUID of a vfat partition? For ext2 / ext3 / ext4, this is done with a simple: tune2fs -U <new-uuid> /dev/<partition> Is there a similar command for vfat partitions?
superuser.com