How to modify initrd/kernel for F2FS /system ? - Android Q&A, Help & Troubleshooting

Hi I tried using F2FS /system on my Redmi Note 4 (mido)
First I flashed a F2FS capable kernel and took a TWRP backup of /system
Next I formatted /system as F2FS
Then I restored the TWRP backup of system after telling it to use rm -rf instead of formatting so it keeps it F2FS
I modified /cust/etc/fstab.qcom to mount /system as F2FS instead of ext4
But when I rebooted to system my phone shutdown during boot which means something went wrong with the mounting
It seems like the kernel or initrd is set to use EXT4. Can someone help me on how to get it to use F2FS ? I don't know how to get UART logs on this phone so that would be helpful too. ADB logcat won't work because it crashes too early

Related

Mounting the second partition of SDCARD as internal memory

Alright so here's the deal, my internal SDCARD is corrupted and the /data partition is unusable.
My device is i9003 and it's running on MIUI at the moment. By default MIUI didn't detect my external SD or my internal SD but after editing "vold.fstab" I was able to mount the first partition of my external SDCARD as external memory and everything was good, I could finally use the camera and pretty much do everything else.
But I was still unable to mount the second partition of my external SDCARD as my internal memory which meant none of my messages could be saved and the phone would pretty much go back to factory settings after a reboot, this apparently is because the /data partition (present on the internal memory) stores all the user data such as the time, the theme I'm using, etc and not having a /data partition meant none of these settings were really saved.
Having no internal memory also means I cannot install any apps such as Link2SD.
Moving on, after many hours of googling I found out that it might not be possible to mount the internal memory using "vold.fstab" and the only way to do it could be by mounting the memory manually during init.
So here's what I want again, I want to use the second partition of my external SDCARD as internal memory, this is likely to solve all my problems and make my phone usable again.
Thanks for all the help, appreciate it.
You need to edit /init.rc (or init.vendor.rc). To make the edits here stay, you'll need to create a new boot.img to flash your device with.
Have a look at an extract of mine init.<vendor>.rc:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
#mount yaffs2 [email protected] /system
#mount yaffs2 [email protected] /system ro remount
# Use below two lines instead of above to run /system from SDcard instead of internal flash
mount ext3 /dev/block/mmcblk0p3 /system
mount ext3 /dev/block/mmcblk0p3 /system ro remount
#mount yaffs2 [email protected] /data nosuid nodev
mount ext3 /dev/block/mmcblk0p4 /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
Compare the lines I've commented out with the others. Here both /data and /system resides on the SDcard, you only need to care about /data. Also remember your device nodes may not be named "mmcblk0p3" etc.
But you'll need to make those changes in the initramfs in your flashed boot.img to make them stay.
kuisma said:
You need to edit /init.rc (or init.vendor.rc). To make the edits here stay, you'll need to create a new boot.img to flash your device with.
Have a look at an extract of mine init.<vendor>.rc:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
#mount yaffs2 [email protected] /system
#mount yaffs2 [email protected] /system ro remount
# Use below two lines instead of above to run /system from SDcard instead of internal flash
mount ext3 /dev/block/mmcblk0p3 /system
mount ext3 /dev/block/mmcblk0p3 /system ro remount
#mount yaffs2 [email protected] /data nosuid nodev
mount ext3 /dev/block/mmcblk0p4 /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
Compare the lines I've commented out with the others. Here both /data and /system resides on the SDcard, you only need to care about /data. Also remember your device nodes may not be named "mmcblk0p3" etc.
But you'll need to make those changes in the initramfs in your flashed boot.img to make them stay.
Click to expand...
Click to collapse
Thanks for the reply man, mind telling me the how I can go about doing this?, I've got the ROM I flashed via CWM here with me, I could send it over to you if that would make things easier for you.
EDIT: would pulling init.rc via ADB, making the changes and pushing it back do the trick? or do I have to go for the boot.img? In case it's the latter, I'm going to need help doing it.
PhantomPhreek said:
Thanks for the reply man, mind telling me the how I can go about doing this?, I've got the ROM I flashed via CWM here with me, I could send it over to you if that would make things easier for you.
Click to expand...
Click to collapse
You'll find a good tutorial about how to work with boot images here: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
If you already got the ROM in a file, this should be easy! Got ADB and FASTBOOT as well?
kuisma said:
You'll find a good tutorial about how to work with boot images here: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
If you already got the ROM in a file, this should be easy! Got ADB and FASTBOOT as well?
Click to expand...
Click to collapse
I'm not sure I've got FASTBOOT but I've definitely got ADB and I've also got the ROM. Would pulling init.rc via ADB, making the changes and pushing it back do the trick? or do I have to go for the boot.img?.
PhantomPhreek said:
I'm not sure I've got FASTBOOT but I've definitely got ADB and I've also got the ROM. Would pulling init.rc via ADB, making the changes and pushing it back do the trick? or do I have to go for the boot.img?.
Click to expand...
Click to collapse
No. You need to reboot the phone for the init.rc script to execute, and once you reboot the phone, the root file system is overwritten by the flashed image ... Catch 22.
You'll NEED to create a new boot.img with a new initramfs containing your changes.
kuisma said:
No. You need to reboot the phone for the init.rc script to execute, and once you reboot the phone, the root file system is overwritten by the flashed image ... Catch 22.
You'll NEED to create a new boot.img with a new initramfs containing your changes.
Click to expand...
Click to collapse
Shucks, this explains why it didn't work. Alright, so I extract boot.img from the rom, follow the tutorial.What is it that I have to edit again? "/init.rc" or "init.<vendor>.rc"?.
Thanks for the help man, appreciate it.
EDIT: Looks like the tutorial is meant for Linux, I'm currently on Windows. I might be asking for a lot here but is there any chance I could get you to do it for me?
PhantomPhreek said:
Shucks, this explains why it didn't work. Alright, so I extract boot.img from the rom, follow the tutorial.What is it that I have to edit again? "/init.rc" or "init.<vendor>.rc"?.
Thanks for the help man, appreciate it.
Click to expand...
Click to collapse
Of course, MIUI may have some boot hooks you could use to re-mount /data after boot. I know nothing about that ROM. Also keep in mind that each time you update the ROM, you have to remake this edit.
Also, no idea what MIUI calls its init.rc, you'll just have to see for yourself. If you've got the mount commands in init.rc, fine. Else look elsewhere.
A good first step would to make sure you really are able to flash a new boot.img. Download fastboot and verify your device understands it. Else you have to use some proprietary flash program, and I'm not familiar with Samsungs bootloaders at all. Ask in the Samsung forum if so.
kuisma said:
Of course, MIUI may have some boot hooks you could use to re-mount /data after boot. I know nothing about that ROM. Also keep in mind that each time you update the ROM, you have to remake this edit.
Also, no idea what MIUI calls its init.rc, you'll just have to see for yourself. If you've got the mount commands in init.rc, fine. Else look elsewhere.
A good first step would to make sure you really are able to flash a new boot.img. Download fastboot and verify your device understands it. Else you have to use some proprietary flash program, and I'm not familiar with Samsungs bootloaders at all. Ask in the Samsung forum if so.
Click to expand...
Click to collapse
Looks like the tutorial is meant for Linux, I'm currently on Windows. I might be asking for a lot here but is there any chance I could get you to do it for me?. ADB and I do see the file init.rc and I also see the mount commands as well. I used adb shell to run the command you sent over with a few edits for second partition and it does mount but as you said, it all goes away after reboot.
PhantomPhreek said:
Looks like the tutorial is meant for Linux, I'm currently on Windows. I might be asking for a lot here but is there any chance I could get you to do it for me?. ADB and I do see the file init.rc and I also see the mount commands as well. I used adb shell to run the command you sent over with a few edits for second partition and it does mount but as you said, it all goes away after reboot.
Click to expand...
Click to collapse
Hmm... are you even able to create a second ext3 partition on the SDcard using Windos..?
kuisma said:
Hmm... are you even able to create a second ext3 partition on the SDcard using Windos..?
Click to expand...
Click to collapse
haha, I used CWM to create the partitions initially, but then I used a software called MiniTool, works well. Can I get you to to do it?
PhantomPhreek said:
Alright so here's the deal, my internal SDCARD is corrupted and the /data partition is unusable.
Click to expand...
Click to collapse
The ROM you are using requires an ext4 partition as partition #3 of the SDcard. This is mounted as /data. Repartition your SDcard #1 as FAT, #2 whatever, and #3 as ext4, and everything will work as intended. :victory:
I guess you've missed this in the ROM documentation ...
kuisma said:
The ROM you are using requires an ext4 partition as partition #3 of the SDcard. This is mounted as /data. Repartition your SDcard #1 as FAT, #2 whatever, and #3 as ext4, and everything will work as intended. :victory:
I guess you've missed this in the ROM documentation ...
Click to expand...
Click to collapse
Wah~ really?, I'll try that and get back here with the results. Thanks a lot!.
EDIT: Is it FAT or FAT32?
PhantomPhreek said:
Wah~ really?, I'll try that and get back here with the results. Thanks a lot!.
EDIT: Is it FAT or FAT32?
Click to expand...
Click to collapse
FAT32.
kuisma said:
FAT32.
Click to expand...
Click to collapse
Tried but didn't work out. I made three partitions, all primary - #1 FAT32, #2 FAT32, #3 EXT4. Plugged the SDCARD in and the external memory was detected as usual, but not the internal memory.
I tried changing the time, it was reset back after reboot.
After that I left the SDCARD as is and flashed the ROM again and now, neither the internal nor the external memory are detected. This is probably because the "vold.fstab" which was edited by me, was overwritten on re flashing.
I'm at a dead end, any ideas?
PhantomPhreek said:
Tried but didn't work out. I made three partitions, all primary - #1 FAT32, #2 FAT32, #3 EXT4. Plugged the SDCARD in and the external memory was detected as usual, but not the internal memory.
I tried changing the time, it was reset back after reboot.
After that I left the SDCARD as is and flashed the ROM again and now, neither the internal nor the external memory are detected. This is probably because the "vold.fstab" which was edited by me, was overwritten on re flashing.
I'm at a dead end, any ideas?
Click to expand...
Click to collapse
Attach an output of "df", "mount", the file "/init.latona.rc" and "/etc/vold.fstab" here, and I'll have a look at it. Hmm... include the output of "dmesg" as well, to be on the safe side.
kuisma said:
Attach an output of "df", "mount", the file "/init.latona.rc" and "/etc/vold.fstab" here, and I'll have a look at it. Hmm... include the output of "dmesg" as well, to be on the safe side.
Click to expand...
Click to collapse
What bugs me is the fact that the external SD is not detected, from what little knowledge I have, external SD is unrelated to the internal SD which I currently have problems with, meaning it should be detected without a problem.
Also I have to add, CWM doesn't detect my external SD right away, when I go to recovery and go over to "Choose zip from sdcard" it says "E:Can't mount /sdcard/". The solution I've found coincidentally is to go to "mounts & storage", mount "/emmc", pull the SDCARD out plug it in again and then "mount /sdcard" this works perfectly and I'm able to flash roms from the sdcard.
One problem at a time, please. Attach the files I requsted, so we can determine why /data failes to mount. Looking at your ROM:
Code:
$ grep " /data$" init.latona.rc
mount ext4 /dev/block/mmcblk0p3 /data
I want to know why this fails, and I guess the answer is in the dmesg output. And please before I'll get another whiskey.
kuisma said:
One problem at a time, please. Attach the files I requsted, so we can determine why /data failes to mount. Looking at your ROM:
Code:
$ grep " /data$" init.latona.rc
mount ext4 /dev/block/mmcblk0p3 /data
I want to know why this fails, and I guess the answer is in the dmesg output. And please before I'll get another whiskey.
Click to expand...
Click to collapse
I can't seem to find "/init.latona.rc" everything else you requested I've mailed them over already
EDIT: the dmesg output is AFTER I mounted "/sdcard" manually as explained in my previous post.
PhantomPhreek said:
I can't seem to find "/init.latona.rc" everything else you requested I've mailed them over already
EDIT: the dmesg output is AFTER I mounted "/sdcard" manually as explained in my previous post.
Click to expand...
Click to collapse
The files you mailed me does not correspond to the ROM you refereed.
The /etc/fstab show that /data is mounted as an rfs file system, not ext4. So either format partition #3 on the sdcard as rfs (Samsung proprietary), or edit /etc/fstab and change "rfs" to "ext4". I'd prefer the later, assuming your kernel supports ext4. Else use ext3.
Code:
/dev/block/mmcblk0p3 /data rfs rw
But you can't have flashed the ROM you told me you did. It excepted an ext4 file system ...

Greenhorn here, what do if you've formatted filesystems and now get please enter pass

I've been playing around with which filesystems I can format the android systems partitions and then install a custom ROM on.
I tried formatting them to F2FS and then installing a CM and Squids kernel found it wouldn't boot, then wiped them back and formatted
them to ext4 (which I think is the default android filesystem) and installed CM and Squid's kernel
and now on boot its asking me to enter a password to boot my android system.
partitions were the filesystems were changed are /system /data /cache.
I really don't want to be admitting this right now that I bjorked my system while tinker gnoming,
and don't know enough to put it back.
But yeah formatting ext4 /data /cache /system and then flashing everything back should have done it right?
Damn think I may have run into a bug in the Recovery where no matter what happens it still thinks /data is f2fs even when its been formatted back to ext4
Never mind unbricked it, I think this is the end of late night beer fueled tinkering for me, but I've restored the system.
Should TWRP have been able to format /data to another filesystem besides ext4 or f2fs and which filesystem was the
default on /data from the beginning?
The recovery system seemed to assume that /data was F2FS and even after trying to format it with something different
the repair tool ran was always the F2FS one and always dropped some error messages even after a format to Ext4.
This whole project started when I got the 'good idea' into my head to see if I could format all the partitions that mattered with
F2FS and flash CM 12.1 R53 with Squid's R8 with the partitions formatted F2FS.
Eh I'm done shooting myself in the foot for awhile (or the ass).
Ended with /system (ext4), /data (f2fs), /cache (ext4) and then flashed everything and the system is running great.
The whole experience was worth getting more familiar with TWRP and learning that it is built noob 'tough'.
And can perform awesome awesome surgery for you, when your done shooting your self in the ass.
By the way bro... I think the data partition on this phone comes in f2fs by default
Sent from my MotoE2(4G-LTE) using Tapatalk
I have the same issue!
Fishy.. why in the hell would you do that unless you *found* a phone
and were then trying like a noob to reformat it ?

[RESOLVED], trying to convert EXT4 to F2FS but keep getting failed to mount 'cache'

i keep getting failed to mount 'cache' (operation not supported on transport endpoint)
the same happens if i try to convert data partition. tried a number of twrp but i get this error
im on the official TWRP with f2fs support provided by thestrix
i currently have lineageOS with radon kernel, anyone can help? i can format it back to ext4 without any prob but when i convert to f2fs, it actually converts it but fails to mount etc.
I've tested a few recoveries and not many mount properly here. Try this one.
https://www.androidfilehost.com/?fid=24591000424943818
theoneofgod said:
I've tested a few recoveries and not many mount properly here. Try this one.
https://www.androidfilehost.com/?fid=24591000424943818
Click to expand...
Click to collapse
sadly i get "Unable to Mount storage" after format
UPDATE
it works even if i got the unable to mount for the /cache partition . my phone boots up properly
similarly for the date partition, formatted without a hitch, no mount error, thank you so much!!!!
i hope the strix updates his recovery

F2FS /system not working

To try to use F2FS on /system I did these steps
1. Installed F2FS compatible kernel
2. Took TWRP backup of /system
3. Formatted /system as F2FS
4. Enabled use rm -rf instead of formatting in recovery
5. Restored /system backup to the newly formatted F2FS /system
6. Edited /cust/etc/fstab.qcom to mount /system as F2FS
7. Rebooted but phone shuts down during mounting/kernel boot probably due to ramfs trying to mount as ext4 instead of F2FS
ROM is Pixel Experience and kernel is KudKernel.
I don't know how to obtain boot logs on this device since it doesn't have a UART and it crashes too early for ADB to be usable. Being able to obtain logs would be really helpful for this
I'm on AOSP extended Pie (latest) with Englezos kernel.
My cache is f2fs.
I had data as f2fs as well but kept encountering problems, most significantly, Magisk would not function normally.
On my next clean flash I'll just go stock file systems since from what I've read and experienced, the difference in performance is negligible to minimal.
not recommended use f2fs on mido. which is unstable

Unable to format from F2FS to ext4 on Joyeuse (Global note 9 pro - RJZMIXM)

So a few months back, I decided to format my data partition to F2FS and see how it works, so I used orangefox rec. and it successfully changed the data partition from ext4 to F2FS.
But today, I wanted to get back to ext4, and so i went to orangefox and formatted my data partition to ext4. And then i rebooted, But after rebooting, it was still showing F2FS for data partiton, so i again changed file system to ext4 and this time, i formatted data as well. But even after doing that, when i rebooted, it was still showing me F2FS.
So pretty much , Im stuck on F2FS.
Can anyone help me how to fix this? I have used fastboot to try and force change the data partiton to ext4 , but it just gives errors.

Categories

Resources