will formatting /data from TWRP/heimdall recreate sdcard ? - Galaxy Tab 3 Q&A, Help & Troubleshooting

I am trying to install postmarketos on /data partition on Galaxy Tab 3 7.0. I am trying to use /data for installation rather /system as /data is much bigger.
While installing postmarketos, /data will be reformatted. I know /sdcard is a special mount inside /data. If after installing postmarketos I want to come back to AOSP/Lineage, will formatting /data in TWRP or via heimdall recreate /sdcard properly. I am not sure if /sdcard is just a inode/path reference or a particular sector reference inside /data.

Related

[Dev Q] mount 2nd ext partition as mmcblk0p3?

Hope this is in the right section, I need help from a developer on this as I don't quite understand what is needed to do this.
I use Gingervillain and the DT a2sd. What I want to do is move my /cache (not dalvik cache but the partition itself) to ext.
I have the commands all ready to do this and that aspect works fine (thanks to help from droidzone).
However, as its sharing the ext partition with DT, when I mount cache there, the apps don't work. Added to which if a market app is downloaded, it downloads the apk to the cache folder I created on ext fine. When it attempts to intall, it fails.
I assume (with my limited knowledge) that there is a conflict here due to multiple mounts on the same partition. I initially thought my mount cache command needed to with the same options that DT mounts, but cant find that reference in his script or the files it calls.
So I have created a 2nd ext partition, but I dont know how to use it. I thought it would automatically be mmcblk0p3, but I cant find it that way using adb.
I know data2ext uses multiple partitions for sqlite etc, but cant for the life of me work this out.
Can anyone point me in the right direction please?
The aim of this is to develop myself a cache2sd solution. I have searched around a lot but can't find one. I thought CM had one but cannot find that either.
Further to this, ls /dev/block lists mmcblk0p3
However,
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p3 /system/sd
Returns
Code:
failed: Invalid Argument
but
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd
Works fine.
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
format
rootSU said:
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
Click to expand...
Click to collapse
format mmcblk0p3 in ext4 format and mount it
susmaz said:
format mmcblk0p3 in ext4 format and mount it
Click to expand...
Click to collapse
Better 2.5 years late than never
Although that would not have been the answer.
Why do you need this 2nd partition??
If i understnad correctly you want the cache on a ext partition, so the play store can download to this partition and than install the apk to intern bzw. The prim ext??

[Q] Error formatting /data! Error formatting /cache!

Using CWM 5.0.2.0, when I try to format /data, I get:
Error formatting /data!
When I try to format /cache, I get:
Error formatting /cache!
This all started because I decided to try Albinoman's AOSP 4.2 ROM. This is what happened:
1. Booted into CWM 5.0.2.0, made a nandroid backup of stock GB ROM.
2. Installed Albinoman's ROM using CWM, wiped /cache and /data.
3. Booted Albinoman's ROM, no problems. Decided I wanted to backup and restore some apps in the old ROM using Titanium Backup.
4. Restored nandroid backup of stock ROM. When it rebooted, all was well.
5. Used Titanium Backup to back up my apps.
6. Installed Albinoman's ROM again.
7. Cleared /data, it was fine. Cleared /cache. Stuck at "formatting" for half an hour.
8. Rebooted back to recovery and tried it again. Couldn't find E:.
9. Tried letting it boot. Stuck on the boot animation for 30-minutes.
10. Wipe everything and re-flash. Tried again. Still stuck on boot animation.
11. Manually unmount and tried to format /data and /cache, and I get the error messages.
I had installed Convert2Ext4_no_data_limit_normal_dalvik.zip to the stock ROM about 4-months ago, not sure if that makes a difference or not.
When I search, it looks like the news is bad... most people that had this error gave up and believed it to be hardware NAND failure. Anything I can do to confirm or rule out NAND failure?
UPDATE: Managed to flash RUU, but results were interesting. It worked and it boots, home screen is blank (no HTC widgets), and apps I'd installed are still there. Clear Storage and Factory Reset does not get rid of them! I can manually uninstall apps, but when I reboot, they come back. I guess the /data must be stuck in some kind of read-only state.
GnatGoSplat said:
Using CWM 5.0.2.0, when I try to format /data, I get:
Error formatting /data!
When I try to format /cache, I get:
Error formatting /cache!
This all started because I decided to try Albinoman's AOSP 4.2 ROM. This is what happened:
1. Booted into CWM 5.0.2.0, made a nandroid backup of stock GB ROM.
2. Installed Albinoman's ROM using CWM, wiped /cache and /data.
3. Booted Albinoman's ROM, no problems. Decided I wanted to backup and restore some apps in the old ROM using Titanium Backup.
4. Restored nandroid backup of stock ROM. When it rebooted, all was well.
5. Used Titanium Backup to back up my apps.
6. Installed Albinoman's ROM again.
7. Cleared /data, it was fine. Cleared /cache. Stuck at "formatting" for half an hour.
8. Rebooted back to recovery and tried it again. Couldn't find E:.
9. Tried letting it boot. Stuck on the boot animation for 30-minutes.
10. Wipe everything and re-flash. Tried again. Still stuck on boot animation.
11. Manually unmount and tried to format /data and /cache, and I get the error messages.
I had installed Convert2Ext4_no_data_limit_normal_dalvik.zip to the stock ROM about 4-months ago, not sure if that makes a difference or not.
When I search, it looks like the news is bad... most people that had this error gave up and believed it to be hardware NAND failure. Anything I can do to confirm or rule out NAND failure?
UPDATE: Managed to flash RUU, but results were interesting. It worked and it boots, home screen is blank (no HTC widgets), and apps I'd installed are still there. Clear Storage and Factory Reset does not get rid of them! I can manually uninstall apps, but when I reboot, they come back. I guess the /data must be stuck in some kind of read-only state.
Click to expand...
Click to collapse
Did you reflash the Convert2Ext4 mod after you flashed the new rom? See this thread and read the top part after 'IMPORTANT:' There is a link in there to the old thread as well with a lot of info.
I did try that, but my /data and /cache are still unable to be written to, wiped, or formatted.
e2fsck won't touch /data, it has a superblock error. It finds errors on /cache and appears to be fixing them, but when I re-run it, the same errors are still there.
GnatGoSplat said:
I did try that, but my /data and /cache are still unable to be written to, wiped, or formatted.
e2fsck won't touch /data, it has a superblock error. It finds errors on /cache and appears to be fixing them, but when I re-run it, the same errors are still there.
Click to expand...
Click to collapse
Since you flashed the RUU, did you install an EXT4 compatible kernel or are you using the stock kernel? Maybe try restoring your working nandroid backup, then run the .zip to revert Convert2Ext4. Or even better, if you have a nandroid from before you installed the EXT4 mod.
DaggerDave said:
Since you flashed the RUU, did you install an EXT4 compatible kernel or are you using the stock kernel? Maybe try restoring your working nandroid backup, then run the .zip to revert Convert2Ext4. Or even better, if you have a nandroid from before you installed the EXT4 mod.
Click to expand...
Click to collapse
Wiping /data and /cache are enough to revert the mod.
Sent from my Galaxy Nexus using Tapatalk 2
Uggh, definitely doesn't sound so good. Since the RUU won't work, I'd say check out this thread:
http://forum.xda-developers.com/showthread.php?t=2123966
Yep, my partitions are no longer EXT4. #1 is EXT3 and #2 is EXT2. I guess that means Convert2Ext4 is no longer in play and the problem is unrelated.
Here is my parted:
Code:
parted /dev/block/mmcblk0 print
Model: MMC SEM08G (sd/mmc)
Disk /dev/block/mmcblk0: 7944MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext3
2 797MB 1007MB 210MB primary ext2
3 1007MB 7944MB 6937MB primary fat32 lba
Yeah, I read that thread and it didn't sound encouraging! I get pretty much the same errors.
Even rm 1 and rm 2 don't remove the partitions. It's like they're read-only. I'm using the parted from CWM 5.0.2.0. Should I use a different one?
Also when I try e2fsck on it:
Code:
~ # e2fsck -pf /dev/block/mmcblk0p1
e2fsck -pf /dev/block/mmcblk0p1
/dev/block/mmcblk0p1: recovering journal
e2fsck: unable to set superblock flags on /dev/block/mmcblk0p1
~ # e2fsck -pf /dev/block/mmcblk0p2
e2fsck -pf /dev/block/mmcblk0p2
/dev/block/mmcblk0p2: Unconnected directory inode 34817 (/???)
/dev/block/mmcblk0p2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
~ # e2fsck -f /dev/block/mmcblk0p2
e2fsck -f /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 34817 (/???)
Connect to /lost+found<y>? y
yes
Pass 4: Checking reference counts
Inode 2 ref count is 2, should be 3. Fix<y>? yes
Inode 34817 ref count is 3, should be 2. Fix<y>? y
yes
Pass 5: Checking group summary information
Block bitmap differences: +274 +(449--510) +(645--701) -(139524--139541) -(139
85--139800)
Fix<y>? yes
Free blocks count wrong for group #0 (7919, counted=7799).
Fix<y>? y
yes
Free blocks count wrong for group #17 (7934, counted=7929).
Fix<y>? yes
Free blocks count wrong (198324, counted=198199).
Fix<y>? y
yes
Free inodes count wrong for group #17 (2048, counted=2045).
Fix<y>? yes
Directories count wrong for group #17 (0, counted=1).
Fix<y>? y
yes
Free inodes count wrong (51189, counted=51186).
Fix<y>? yes
/dev/block/mmcblk0p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p2: 14/51200 files (14.3% non-contiguous), 6601/204800 blocks
When I tried it without the -p is when it looks above like it's fixing something, but it really didn't fix anything because it does the same thing when I try e2fsck again (as if it's read-only).
Is MMCBLK0 one physical NAND chip? If so, how come I can read/write/erase the /emmc with no problems? Isn't that just another partition on the same NAND disk?
If /data and /cache are really bad, is there any possible way to do an equivalent of a low-level format on the NAND and repartition?
Is booting CWM 5.0.2.0 and using adb shell supposed to have root privileges?
I can't modify the partition table using either parted or fdisk. I even tried zeroing the partitions using dd if=/dev/zero of=/dev/block/mmcblk0p1, p2, and even the whole of mmcblk0, but nothing actually gets written.
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
GnatGoSplat said:
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
Click to expand...
Click to collapse
It is hard coded into the kernel. To get root in adbshell try typimg su. This seems to be happening to more and more people as these phones get up there in age.
GnatGoSplat said:
Since it seems like the NAND is probably irreparably borked, can I approach this problem from a different angle?
Can I partition my sdcard with an ext3 and ext2 partition, and tell Android to use those as /data and /cache respectively?
What in Android maps /dev/block/mmcblk0p1 to /data and /dev/block/mmcblk0p2 to /cache, and can I change those to point to partitions on sdcard?
Or is that hard-coded into the kernel?
Click to expand...
Click to collapse
The answer is yes to both actually. Thrle boot.img would need to be customized. The best way is a flashable zip in recovery. Data and cache would need to be wiped manually ad recovery will not pick this up. Expect poorer performance though as SD cards tend to be slower than built in storage.
Sent from my Galaxy Nexus using Tapatalk 2
Thanks! So it sounds like the way to make this work is to compile a custom kernel? I don't know the first thing about it, but I think I could learn.
This is only in the kernel, so I could flash any 3rd party D-Inc ROM and just flash my customized kernel and it will see /data and /cache on the sdcard?
I could probably get one of those fast Class 10 cards if it turns out this is too slow, but I do recall changing vold.fstab once to fool Android into seeing /emmc as /sdcard and the /emmc (as /sdcard) didn't benchmark all that much faster than a real sdcard. I'm assuming /data and /cache are the same speed as /emmc since they're on the same mmcblk0 device, so I'm thinking maybe sdcard performance would be acceptable.
This actually sounds like it could be a better long-term solution than replacing the motherboard because no telling if a new motherboard will fail soon too.
The motherboard should be reliable. Emmc may die. Especially considering how old current dincs are.
I was talking about the boot.img which is not ROM independent and kernels aren't always either. Best idea is a flashable zip to modify the ram disk but I need the partition names if you decide to do it. I recommend keeping cache and data in the same order.
Also there would need to be a flashable wipe script to wipe data and cache.
Sent from my Galaxy Nexus using Tapatalk 2
Sorry, I wasn't very clear. By motherboard failing, I was assuming NAND is soldered to the motherboard, and if that's the case, ruined NAND = ruined motherboard. I had thought maybe I could buy a DInc with smashed LCD and good motherboard and just swap into mine (because mine is MINT condition), but I thought if I do that, I could very well end up in the same place as I'm in now and using sdcard would be more of a guarantee I wouldn't have to worry about this again.
I think I understand, the boot.img and kernel aren't exactly the same thing, but the kernel is part of boot.img? Or is it only the RAMDisk that needs changed, or both? You mentioned partition names, are you offering to make these modifications for me?
By same order, do you mean because mmcblk0p1 is /data, mmcblk0p2 is /cache, and mmcblkp3 is /emmc, I should partition my sdcard the same way with data 1st, cache 2nd, and sdcard 3rd?
Should I partition it with the phone, PC, or does it matter? Should the sizes of the new /data and /cache be the same size as original, or is there any reason I should make them larger?
Could I wipe the new /data and /cache simply by booting into Recovery and using adb shell and format them?
Also, the commands I was issuing in adb shell were from booting into CWM Recovery. Is it possible that mode can't write because I didn't login as root using the su command? I hadn't thought that would be the problem seeing as how the RUU and Android itself can't write to /data and /cache and other people managed to fix partition problems without needing to run su.
GnatGoSplat said:
Sorry, I wasn't very clear. By motherboard failing, I was assuming NAND is soldered to the motherboard, and if that's the case, ruined NAND = ruined motherboard. I had thought maybe I could buy a DInc with smashed LCD and good motherboard and just swap into mine (because mine is MINT condition), but I thought if I do that, I could very well end up in the same place as I'm in now and using sdcard would be more of a guarantee I wouldn't have to worry about this again.
I think I understand, the boot.img and kernel aren't exactly the same thing, but the kernel is part of boot.img? Or is it only the RAMDisk that needs changed, or both? You mentioned partition names, are you offering to make these modifications for me?
By same order, do you mean because mmcblk0p1 is /data, mmcblk0p2 is /cache, and mmcblkp3 is /emmc, I should partition my sdcard the same way with data 1st, cache 2nd, and sdcard 3rd?
Should I partition it with the phone, PC, or does it matter? Should the sizes of the new /data and /cache be the same size as original, or is there any reason I should make them larger?
Could I wipe the new /data and /cache simply by booting into Recovery and using adb shell and format them?
Also, the commands I was issuing in adb shell were from booting into CWM Recovery. Is it possible that mode can't write because I didn't login as root using the su command? I hadn't thought that would be the problem seeing as how the RUU and Android itself can't write to /data and /cache and other people managed to fix partition problems without needing to run su.
Click to expand...
Click to collapse
The NAND is likely soldered to the motherboard, so you're right about that.
To answer your first question, yeah, the kernel is part of the boot.img. The other part is the RAMdisk which is the only thing that needs to be changed.
Partition it in the same order. Probably parted via adb shell. 100MB for cache and at least 750MB for data. Sizes don't matter too much but you want enough.
adb shell has root access automatically in recovery. The issue is hardware most likely so your proposed workaround may be the only option.
First plan of attack is to find the partition names which would be mmcblk1p1 and mmcblk1p1 if you partition the sdcard the same way as the ROM is partitioned. Ideally you need to be able to fix the partitions themselves. I'll try to give more info later.
I copied the partition sizes from mmcblk0, so here's what I have on my 16GB SD card:
Code:
Model: SD SA16G (sd/mmc)
Disk /dev/block/mmcblk1: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext2
2 797MB 1007MB 210MB primary ext2
3 1007MB 16.0GB 15.0GB primary fat32 lba
mmcblk1p1 for /data
mmcblk1p2 for /cache
mmcblk1p3 for /sdcard
Will that work? I couldn't get mmcblk1p1 to show up as ext3. I did use mke2fs -j /dev/block/mmcblk1p1 to format it and I've read ext3 = ext2+journal, so I guess the fact it's not saying "ext3" under filesystem is okay?
GnatGoSplat said:
I copied the partition sizes from mmcblk0, so here's what I have on my 16GB SD card:
Code:
Model: SD SA16G (sd/mmc)
Disk /dev/block/mmcblk1: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 8192B 797MB 797MB primary ext2
2 797MB 1007MB 210MB primary ext2
3 1007MB 16.0GB 15.0GB primary fat32 lba
mmcblk1p1 for /data
mmcblk1p2 for /cache
mmcblk1p3 for /sdcard
Will that work? I couldn't get mmcblk1p1 to show up as ext3. I did use mke2fs -j /dev/block/mmcblk1p1 to format it and I've read ext3 = ext2+journal, so I guess the fact it's not saying "ext3" under filesystem is okay?
Click to expand...
Click to collapse
You would be correct. Yes, that's fine.
Thanks, what should be my next steps?
GnatGoSplat said:
Thanks, what should be my next steps?
Click to expand...
Click to collapse
I'll have to find time to make scripts that will modify the ramdisk, unless you can just extract it and make the changes yourself.
That would be great, I really appreciate all the help so far.
Do you think ramdisk is the only place a change will need to be made?
I was trying to see if I could figure out how to extract ramdisk from boot.img and found a perl script, but I haven't gotten around to playing with it.

[Q] Cannot boot by /system on SDCard

I had move the /system partition on sd card, and modified the init file to mount sdcard partition when booting. But it failed and the phone stayed at logo screen.
I create a FAT32 partition and ext4 partitions on sd card with MiniTool partition Wizard, and mount them under /mnt directory.
Then, copy /system partition to sdcard, by cp -a /system /mnt/system.
Finally, I extract the boot partition, modified the init file in ramdisk directory, repack and flash back to internal memory.
The mount info located in init.smdk4x12.rc as mount_all fstab.smdk4x12. So I modify the mount point of /system as sdcard partition.
The phone cannot boot, and stay at logo screen.
However, I use the same method to /cache and /data partitions, it works very well.
So, is there anything wrong with this method for /system partition?
Thanks for your help!!!

[GUIDE] How to flash a ROM on an encrypted device with TWRP.

THIS WILL WIPE YOUR DATA
Android's encryption of the /data partition cannot be unlocked via TWRP or other recoveries. The normal "wipe data/factory reset" will fail, because /data can't be accessed.
I assume your phone has root, and you know how to get a root shell in ADB. There are tons of guides for that, but very few (none that I could find) for this.
First, in your root shell, run:
Code:
cat /etc/fstab
and copy the output to a text file or such where you can refer back to it. You should get something like this:
Code:
/dev/block/mmcblk0p16 /system ext4 rw
/dev/block/mmcblk0p29 /data ext4 rw
/dev/block/mmcblk0p18 /cache ext4 rw
/dev/block/mmcblk0p10 /efs ext4 rw
/external_sd vfat rw
/usb-otg vfat rw
/dev/block/mmcblk0p1 /modem vfat rw
But the /dev/block/... bits may be different for different devices. Mine is a T-Mobile Samsung Galaxy S 4.
Find the line with /data listed on it. In my case, that's "/dev/block/mmcblk0p29 /data ext4 rw".
Then you'll need just the first part. In my case, that's "/dev/block/mmcblk0p29". Using mke2fs we'll format the appropriate block device as ext4.
Code:
mke2fs -t ext4 /dev/block/mmcblk0p29
If your block device is different, then USE YOURS. Using the wrong block device will format the wrong partition. Formatting the /efs partition has been known to brick phones.
This will take a few minutes to complete. Once done, you will have a blank unencrypted /data partition.
Then you can do a normal data wipe/factory reset, install the rom, etc.
Thanks for sharing this but surely it's a lot easier/safer just to Format Data from TWRP?
doveman said:
Thanks for sharing this but surely it's a lot easier/safer just to Format Data from TWRP?
Click to expand...
Click to collapse
Read paragraph after the all caps
serio22 said:
Read paragraph after the all caps
Click to expand...
Click to collapse
Yes, the normal wipe/factory reset doesn't work when it's encrypted but format does. I just did it myself from TWRP for the very reason that there was no other way to factory reset and it worked fine.
Keyword "format" vs "wipe" , it's like the obelisk from "2001", you don't mess with "format" .
Pp.
PanchoPlanet said:
Keyword "format" vs "wipe" , it's like the obelisk from "2001", you don't mess with "format" .
Pp.
Click to expand...
Click to collapse
Er, from the OP
"Then you'll need just the first part. In my case, that's "/dev/block/mmcblk0p29". Using mke2fs we'll format the appropriate block device as ext4.
mke2fs -t ext4 /dev/block/mmcblk0p29"
So that's just formatting it, with the additional risk of failying to identify the correct dev and formatting something you shouldn't!

Unable to format using twrp - Unable to format to remove encryption

Hello everybody. I need Your help.
Last days i tried some ROMs. I have TWRP and before every new upload i FORMAT DATA(Wipe) and of course wipe cache, system
Today when I try to format I have error:
Unable to wipe '/data' -- unknown file system 'auto'
Unable to format to remove encryption
when i typed :
cat /etc/fstab
i got:
/dev/block/mmcblk0p56 /data ext4 rw 0 0
I read some posts of forum and ?solution? to repair is to type this:
make_ext4fs /dev/block/mmcblk0p56
after this i had 0MB Internal Storage and many errors when try to format any data, cache, internal....
So i changed to f2fs and back to ext4 and Internal Storage is OK but still can't format data
Now I can upload ROM but when it starting i have monit "Encryption unsuccessful and interrupted"
PLEASE HELP i can't use my Lenovo :crying:
btw. my linux knowledge is not very well

Categories

Resources