Details for creating cache and userdata partition - Xiaomi Mi 4

Hello everyone, I increased my system partition size successfully using [HOWTO][GUIDE][Mi3][Mi4]Resize/extend system partition capacity by arif920629 guide . I deleted system, system1 , cache and userdata . Now I created the system partitions using "mkpartfs primary ext2 xxx xxx" . But I am confused whether to create the cache and userdata partition in the same way. Also after creating system partitions I used the below code to make them from ext2 to ext4.
"
tune2fs -j /dev/block/mmcblk0p25
e2fsck -fDp /dev/block/mmcblk0p25
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p25
e2fsck -fDp /dev/block/mmcblk0p25
Click to expand...
Click to collapse
But as I change the cache and userdata from ext2 to ext4 using that method then wiping data & or factory reset is not wiping anything. So I guess it not the procedure for the cache and userdata partition . So can someone help me to make them as they should be or used to be.

Related

[Question] Converting MTD Partition(s): yaffs2 -> ext2/3/4

hi @all,
is there a way to convert a mtd partition to another filesystem?
i've tryed the following procedure:
1.) boot to recovery
2.) login to system via adb (adb shell)
3.) mke2fs -m 5 -b 4096 /dev/block/mtdblock1
at point 3, it gives errors and nothing is happen.
now, i've tryed to flash a ext3 filesystem on this partition via
flash_image system system.ex3.img (found a explanation on how to create a ex3 system.img), but after mounting the /dev/block/mtdblock1 on /system it shows still device as "yaffs2".
would be nice, if someone can explain me if it's definitvly not possible to convert
mtd partitions or tell me a short tip what can i test
ThX
Andy
An anything known about this in the last year BUMP

Clean Your File Systems!

Ok, lately we have had a rash of errors and undesired performance. In my opinion, this is unacceptable... So I am trying to fix it. Now, I can't fix every issue, but boy can I sure help most of them...lol
So let's get started. We will call this:
The File System Cleaner
Linux has a few tools for us to see if we have a "Dirty" or "Clean" filesystem.
They are tune2fs, e2fsck, and fsck_msdos.
Now, you can't use all of them for every file system or partition (we will refer to them all as partitions from here on out). Each one works on certain filesystems. For example, e2fsck works on ext type partitions where fsck_msdos works on vfat type partitions, and tune2fs only works on large partitions.
While tune2fs is a tool that gives detailed information about a partition, it can still give us an idea on where we stand on those larger partitions as well as change certain options/features on that partition such as journaling, mount point, mount as rw or ro, etc. But the biggest thing we are going to focus on is 1 line:
Code:
Filesystem state
If you run tune2fs and the filesystem state is anything other than clean, you have some sort of gremlin floating about it and it needs to be fixed. Now what about those partitions in which we get these errors:
t
Code:
tune2fs 1.41.11 (14-Mar-2010)
tune2fs: Attempt to read block from filesystem resulted in short read while trying to open /dev/block/mmcblk0p4
Couldn't find valid filesystem superblock.
1|[email protected]:/ # tune2fs -l /dev/block/mmcblk0p28
tune2fs 1.41.11 (14-Mar-2010)
tune2fs: Bad magic number in super-block while trying to open /dev/block/mmcblk0p28
Couldn't find valid filesystem superblock
It doesn't mean that they are corrupt. It means they are either not in a format that tune2fs can read or they are not a large partition.
So for those partitions that are not compatible with tune2fs, we can use fsck.
The fsck works much like scan disk and defrag in windows. It scans the partition for several different things like bad blocks, missing/corrupt information, etc. Although you can run tune2fs on any large partition whether it is mounted or not, you DO NOT want to fsck ANY partition that is mounted or it WILL result in TOTAL data LOSS! You have been warn!
Keep in mind all this information is at your own risk, but know that I have been using this for quite some time and it hasn't failed me yet. But then again, I follow my instructions to a TEE, as you should as well...
So, here's how we use all this.
First make sure you have adb installed on your computer
To be safe, boot into recovery, plug your phone into your computer and start adb shell
Now type:
Code:
mount /system
cp /system/bin/tune2fs /tmp
cp /system/bin/e2fsck /tmp
cp /system/bin/fsck_msdos /tmp
chmod -R 777 /tmp
cd tmp
Now that our tools are set, we can now begin cleaning house.
First and most important, make sure you umount ALL partitions.
I personally unmount them manually via mounts and storage in CWM.
In terminal (with adb running) type:
Code:
./tune2fs -l <partition>
./e2fsck <partition>
./fsck_msdos <partition>
**NOTE**If you have an error "/sbin/sh: <command>: not found" when executing one of these commands simply mount /system and copy to tmp, and chmod 777 again.**
For more information on the commands, run <command> -h. here you will see additional options for that command.
Now, I didn't break down which partitions work with tune2fs, but /system, /data, and /cache can be scanned with tune2fs.
However, I did break as to what partitions need which fsck command to be cleaned.
Code:
e2fsck
|mount point| |Filesystem type|
/dev/block/mmcblk0p21 /efs
/dev/block/mmcblk0p24 /system
/dev/block/mmcblk0p25 /data
/dev/block/mmcblk0p26 /cache
/dev/block/mmcblk0p27 /tombstones
/dev/block/mmcblk1p2 unknown
Code:
fsck_msdos
|mount point| |Filesystem type|
/dev/block/mmcblk0p4 fsinfo
/dev/block/mmcblk0p13 /system/etc/firmware/misc
/dev/block/mmcblk0p17 /system/etc/firmware/misc_mdm
/dev/block/mmcblk0p28 emmc
/dev/block/mmcblk1p1 /sdcard
Example:
Code:
/tmp # e2fsck /dev/block/mmcblk0p24
e2fsck 1.41.12 (17-May-2010)
/dev/block/mmcblk0p24: clean, 4220/38320 files, 93625/153088 blocks
This should resolve many of your laggy performance and random reboot issues. As well as the issue of freezes after a reboot.
If you are a flash addict, tuning your partitions between flashes my be a GREAT idea...
If you do not have those binaries in your ROM, let me know and I will upload them here...
Now, there is a little more destructive way to clean a partition, and that is to reformat it. Most of us format /system /cache and dalvik in CWM before flashing, but sometimes that isn't enough. All CWM does is erase the files/folders contained in one of those partitions.
Here's how we do a complete reformat:
Reboot to recovery, plug phone in and start adb shell
Type:
Code:
mount /system
cp /system/bin/make_ext4fs /tmp
chmod 777 /tmp/make_ext4fs
mount <system, data or cache partition>
./make_ext4fs <partition>
This only works with ext4 partitions, so use it ONLY on these:
Code:
/dev/block/mmcblk0p24 /system
/dev/block/mmcblk0p25 /data
/dev/block/mmcblk0p26 /cache
I know there are other ext partitions, like tombstone and efs, but DO NOT use this command on them. You may BRICK or damage your device. I will say this again, ONLY DO THIS on data, cache, system!
**NOTE** If you format system partition, you WILL have to flash your ROM and Gapps again...
I have not had windows on this pc for over 2 years now and I think ADB is MS only right? I do flash a lot but I normally run ultimate kernel cleaning script and plus run the wipes a couple times myself and sumtimes format cache partitons before I install a new rom.... I like to make sure I do most I can to clean before I flash...and I always run the LZ kernel Cause its AWESOME!! but I guess my question is how can I look to see if my partitons need to be cleaned.. on AOKP with LZ kernel at moment and it is smooth fast and no bugs or reboots. is there a way to vew the partitions with ubuntu 12.04? or dose ubuntu even need ADB... linux seems very good at haveing the right drivers and software already available without installing to many extras.
not even sure your a linux desktop user but thought I would go ahead and ask.
Many thanks for everything
woodyjlw said:
I have not had windows on this pc for over 2 years now and I think ADB is MS only right? I do flash a lot but I normally run ultimate kernel cleaning script and plus run the wipes a couple times myself and sumtimes format cache partitons before I install a new rom.... I like to make sure I do most I can to clean before I flash...and I always run the LZ kernel Cause its AWESOME!! but I guess my question is how can I look to see if my partitons need to be cleaned.. on AOKP with LZ kernel at moment and it is smooth fast and no bugs or reboots. is there a way to vew the partitions with ubuntu 12.04? or dose ubuntu even need ADB... linux seems very good at haveing the right drivers and software already available without installing to many extras.
not even sure your a linux desktop user but thought I would go ahead and ask.
Many thanks for everything
Click to expand...
Click to collapse
Yeah, I'm completely windows free too...YAY! lol
You still need to install the adb binary/command and put it in your path. The good news is, it's very simple in Linux, unlike wincrapdows...
And then just follow the tutorial to check your partitions...

recover FDE encrypted data xiaomi 5a

Hello:
I have a Xiaomi Redmi 5A stuck at boot logo. I was able to dump all partitions, including userdata, with miracle box software and test point, but it seems that userdata partition is encrypted.
Bootloader is locked, so I think I can't mount encrypted partition with TWRP whitout wiping data.
I can mount system partition. fstab.qcom content is like this:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait,verify
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc wait,resize,reservedsize=128M,forceencrypt=footer <-----
/dev/block/bootdevice/by-name/cust /cust ext4 ro,nosuid,nodev,barrier=1 wait,check
/devices/soc/7864900.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,noemulatedsd,encryptable=footer
/dev/block/bootdevice/by-name/config /frp emmc defaults defaults
/devices/soc/78db000.usb/msm_hsusb_host* auto auto defaults wait,voldmanaged=usbotg:auto,encryptable=footer
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
Androrid version is 7.1.2 and MIUI V10.2.1.0.NDFMIXM
I know the pattern.
I have read about some expoits to get MasterKey. Here are some links
- *******forensicswiki.org/wiki/How_To_Decrypt_Android_Full_Disk_Encryption
- ********nelenkov.blogspot.com/2014/10/revisiting-android-disk-encryption.html
- ********area41.io/downloads/slides/area41_16_kunz_semioffline_attack.pdf
- ********github.com/laginimaineb/android_fde_bruteforce
I tried bruteforce script included in Santoku Linux and it gives me an error. I passed as header parameter first 2048 bytes of userdata partiton and last 16K as footer parameter.
At footer region, "aes-xts" string can be read.
I am afraid about doing a hard reset, if it will reset / change some kind of random key....

twrp.fstab HELP!!!

Hi! I'm a newbie here. I want to ask if the below code is correct for twrp.fstab? Those are the first 5 lines of twrp.fstab.
I change the following lines instead of ".../11120000.msdc0/by-name/system" to ".../11120000.msdc0/mmcblk0p23" and so on.
/dev/block/platform/mtk-msdc.0/11120000.msdc0/mmcblk0p23 /system ext4 ro wait,recoveryonly
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/vendor /vendor ext4 ro wait,recoveryonly
/dev/block/platform/mtk-msdc.0/11120000.msdc0/mmcblk0p25 /data f2fs noatime,nosuid,nodev,discard,noflush_merge wait,check,formattable,resize,encryptable=/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/metadata,
/dev/block/platform/mtk-msdc.0/11120000.msdc0/mmcblk0p24 /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
PS. My recovery.img was ported using twrp auto porter but it can't mount system, data and cache.

Help I unlocked the bootloader and can't decrypt data.

So I unlocked the bootloader, flashed TWRP, and everything went fine. But when I tried to get into TWRP it asks for a password even though I haven't set one.
If I go to cancel > wipe and try to format data it just gives me a lot of red text ("operation not permitted") saying it doesn't have the permissions for a data wipe.
So since the system is still working I went and did a soft data reset since I already flashed TWRP and it doesn't work.
I confirmed it and the device started restarting, but when it booted it booted into TWRP. From TWRP I went back to the system and my data was still there.
I will now download the stock rom and try to flash the stock recovery. Is the problem in TWRP or in my device?
My phone is Motorola moto g8 (XT2045-2)
As soon as the bootloader gets unlocked, a Factory Reset is executed internally, which means that the encryption key gets also deleted, hence you no longer can decrypt encrypted data.
xXx yYy said:
As soon as the bootloader gets unlocked, a Factory Reset is executed internally, which means that the encryption key gets also deleted, hence you no longer can decrypt encrypted data.
Click to expand...
Click to collapse
yes, I know but for some reason it is still asking for a password.
Try default password -> default_password
xXx yYy said:
Try default password -> default_password
Click to expand...
Click to collapse
tried that aswell.. I tried erasing the userdata and cache using fastboot, then set a password in the system and it doesn't work in twrp. even twrp can't format data.
xXx yYy said:
Try default password -> default_password
Click to expand...
Click to collapse
I found out what was wrong, still can't get it to work though.. So the userdata partition was a format TWRP can't decrypt (I think). So I reformatted the userdata partition to ext4 but I get stuck in a bootloop unless I again erase the partition. Any help to how do I format it so it actually boots?
Why don't you ask in the support thread on xda-developers if TWRP is built with encryption support at all?
according to recovery.fstab it uses FBE + metadata encryption, so you probably have to format userdata + metadata once
from fastboot
Code:
fastboot format:f2fs userdata
fastboot format:ext4 metadata
or
from adb shell or terminal
Code:
make_f2fs -f /dev/block/bootdevice/by-name/userdata
mke2fs -t ext4 /dev/block/bootdevice/by-name/metadata
how do I delete double posts?
aIecxs said:
Why don't you ask in the support thread on xda-developers if TWRP is built with encryption support at all?
according to recovery.fstab it uses FBE + metadata encryption, so you probably have to format userdata + metadata once
from fastboot
Code:
fastboot format:f2fs userdata
fastboot format:ext4 metadata
or
from adb shell or terminal
Code:
make_f2fs -f /dev/block/bootdevice/by-name/userdata
mke2fs -t ext4 /dev/block/bootdevice/by-name/metadata
Click to expand...
Click to collapse
Code:
Warning: userdata type is raw, but f2fs was requested for formating.
Formatting is not supported for filesystem with type 'f2fs'.
Code:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
rav:/ $ make_f2fs -f /dev/block/bootdevice/by-name/userdata
/system/bin/sh: make_f2fs: inaccessible or not found
the metadata one worked fine
try mkfs.f2fs instead
aIecxs said:
try mkfs.f2fs instead
Click to expand...
Click to collapse
/system/bin/sh: mkfs.f2fs: inaccessible or not found
where am I supposed to use the adb shell command? in the recovery or while in the system?
can't I just wipe data from the stock recovery and then format metadata?
note with adb shell I meant in TWRP recovery (requires partition unmounted)
uwucake2020 said:
/system/bin/sh: mkfs.f2fs: inaccessible or not found
can't I just wipe data from the stock recovery?
Click to expand...
Click to collapse
aIecxs said:
note with adb shell I meant in TWRP recovery (requires partition unmounted)
Click to expand...
Click to collapse
oh ok wait a minute
I can't umount it..
Code:
127|sofiar:/ # make_f2fs -f /dev/block/bootdevice/by-name/userdata
F2FS-tools: mkfs.f2fs Ver: 1.12.0 (2018-11-12)
Info: Disable heap-based policy
Info: Debug level = 0
Info: Trim is enabled
Error: In use by the system!
1|sofiar:/ # umount /data
umount: /data: Device or resource busy
@aIecxs what can I do here? maybe erase the partition using fastboot or do a factory reset/wipe data using the stock recovery?
edit: I had data transfer on oops
sorry for the ping tho, idk if you can see when I edit a message
/data is not the only mount point. there is also /sdcard (refer to df -a)
this is how it looks on Poco M3. in my case you can see userdata is sda11. sda11 is mounted triple, so we have to umount sda11 until it is completely unmounted
Code:
[root] /: find /dev/block -name userdata
/dev/block/platform/soc/4804000.ufshc/by-name/userdata
[root] /: ls -l /dev/block/platform/soc/4804000.ufshc/by-name/userdata
lrwxrwxrwx 1 0 0 16 1971-05-21 00:59 /dev/block/platform/soc/4804000.ufshc/by-name/userdata -> /dev/block/sda11
[root] /: df -a
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 1788376 68504 1719872 4% /
tmpfs 1902824 572 1902252 1% /dev
tmpfs 1902824 0 1902824 0% /mnt
tmpfs 1902824 0 1902824 0% /apex
tmpfs 1902824 52 1902772 1% /tmp
/dev/block/sde53 364504 3876 360628 2% /cache
/dev/block/sda11 49394556 20677260 28717296 42% /data
/dev/block/sda11 49394556 20677260 28717296 42% /sdcard
/dev/block/sda11 49394556 20677260 28717296 42% /storage
/dev/block/mmcblk0p1 31150720 26539136 4611584 86% /sdcard1
/dev/block/dm-0 2923136 2821180 101956 97% /system_root
/dev/block/sde52 196528 118256 78272 61% /firmware
/dev/block/sde55 999320 583268 416052 59% /cust
/dev/block/sda6 11760 72 11688 1% /metadata
/dev/block/sda7 27632 2156 25476 8% /persist
/dev/block/dm-2 1479100 1374644 104456 93% /product
/dev/block/dm-1 1414572 1309996 104576 93% /vendor
[root] /:
aIecxs said:
note with adb shell I meant in TWRP recovery (requires partition unmounted)
Click to expand...
Click to collapse
got into a bootloop. "android system may be corrupt"
just format in TWRP recovery + stay in TWRP recovery and pull recovery.log, that's all you can do for now. this is for maintainer to look at
aIecxs said:
just format in TWRP recovery + stay in TWRP recovery and pull recovery.log, that's all you can do for now. this is for maintainer to look at
Click to expand...
Click to collapse
i don't think the problem is in TWRP, every time I format a partition to ext4 it bootloops :/
according to recovery.fstab /data is f2fs and /metadata is ext4. so formatting should work from fastboot and from twrp. you must not boot into android, reboot straight into recovery back again, then get recovery.log. boot loop is different issue, probably dm-verity
aIecxs said:
just format in TWRP recovery + stay in TWRP recovery and pull recovery.log, that's all you can do for now. this is for maintainer to look at
Click to expand...
Click to collapse
I just checked and the problem is in formatting the data partition, idk why tho
without recovery.log it's all just guesswork.. kindly re-read how to format

Categories

Resources