[MAGISK][TWRP][ARM32/64][A8+]Universal Read Only to Read Write for android (RO2RW) | Auto converting SUPER "system partitions" to read/write mode

Add support for other CPU architectures?


  • Total voters
    12
Search This thread

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3

Read Only to Read Write for android (RO2RW)

Update 03.01.2023 : Stable Beta v 3.7.2.1

The first truly working script, original and unique in its logic for all devices with a SUPER partition

Universal auto RO2RW | EROFS-2-RW | F2FS-2-RW by LeeGarChat

27013307.png


photo_2022-12-05_14-01-11 (1).jpg
photo_2022-12-05_14-01-13 (1).jpg


Short description:
Converts EROFS, EXT4(RO), F2FS Super partition to RW

Description:
A simple utility to convert your Super partition to RW mode (Read/Write) As well as the expansion and distribution of free space for each section, depending on how much space is available in the original Super section.
You can flash both via:
1. TWRP: by using controls in the script: (Volume control (+) to switch, Volume control (-) to select) in this case, the new super RW is flashed directly.
2. Magisk module: in this case you will need to go to the terminal and enter RO2RW, and a new RW-super.img will be prepared in the internal memory, you can choose both image output for FASTBOOT and RECOVERY.
For these two modes, the creation of the original super as a backup is supported, the file will also be output to the internal memory as bak-super.img

Do I need to format the data after installation?

- No, it is not necessary in normal cases, this script does not affect encryption in the data section. But in some cases, it is necessary to do the date format, it is not yet clear how this is related, for example on Asus devices.


Why do I need this script, for what and why; why do I, need it?

- When your system partitions have read-only mode (RO), then you cannot integrate modifications directly into the firmware, (such as Viper4Android) as well as manually edit/delete files from system partitions. This script converts it in the case of F2FS and EROFS to EXT4, or forcibly in the case of EXT4 enables the "Read/Write" (RW) mode, and also expands partitions as much as possible.

What are systems partitions?

What are system partitions?
- These are the sections that are located in the main container "super" (the script is focused only on devices with super), it includes system, product, vendor, etc., when mounting the system, the structure looks like this:
System <--- In TWRP it is mounted as /system_root
, in the system itself it is mounted as
Code:
/ <--- The main mount point for system
├── /product <--- The main mount point for product
├── /vendor <--- The main mount point for vendor                            
|
├── /system <--- Here are the main system files
│   │
│   ├── /system/vendor <--- Additional mount point for vendor
│   │
│   ├── /system/product <--- Additional mount point for product

And by analogy with product and system, all other partitions, or other mount points. This can be viewed in the fstab file located in vendor/etc/
Some files cannot be edited at the root, or even if they can be edited without RW, those modifications won't stick, because these are temporary files responsible for the operation of the kernel and the entire linux system, in this case android. For example, proc, or sys, if you open a clean image, or mount a system image, you will see that these folders are empty, and files appear there only after the system is started.

Is ROOT required?

- If you want to prepare a new super partition inside the system, then you need it, the firmware via TWRP does not need root.

How does the script work in Magisk?

- You need to install the archive via Magisk manager as a module, the script will tell you if you need to restart the device. Next, you need to launch the terminal and give it root rights with the command "su", Then enter the command "RO2RW" and the script will run, it will prepare an image of RW-super.img according to your choice and optionally backup the original super bak-super.img, these files will be located in internal memory, after which you need to them to a PC if it is a fastboot image, or flash it via TWRP as super img if the images are for recovery.

What does S=40% SE=10% and so on mean?

- This is the distribution of free space in the super between the partitions 'System=S' 'Product=P' 'System_ext=SE' 'Vendor=V' 'Other sections are there they are= OT'
- For example: The whole system occupies a conditional 4.7 GB. The super partition always has a fixed size in the memory block on the device, for example, take the example with PocoF3, it has 8.5GB there

Code:
Super size 8.5-GB
{1111111111,111111111111,111111111,11111,11111111,111111111111111,000000000000000}
   System    System_ext   Product   Odm   Vendor   Others if any   Unused memory
  2.2/2.2G   0.5/0.5G     0.8/0.8G  7/7M  1.2/1.2G    1/1GB           3.8~G
- As you can see, there is unused space for the second slot in the section (In 99.99% of cases it is not needed for users with root), and we can use this space for expansion of the partitions, and for system, 40% of this free space will be distributed. For system_ext 10%, for other partitions, if there are any, conditional 10% will be divided between all of them

RO2RW worked correctly, and the system started, but I can't delete or change files, what is the reason?

- Perhaps you have some Magisk module installed that prevents you from doing this, for example OverlayFS.
Also, the reason may be that your device is of the MTK family, in some models there is a restriction at the kernel level for changing system partitions, and therefore mounting in RW, you will not even be able to reinstall magisk on such devices from the system
In this case, you open the way only to modding via TWRP

Also, you need to use the latest version of a normal file manager, these are the ones I recommend:
Solid Explorer File Manager
Root Explorer
MT manager

RO2RW worked correctly, the system started, but in any section, for example vendor, there is little free space available, 2-10mb, can it be expanded somehow?

In- That's how it will not be possible to expand a lot, this is due to the limitation of space in the super itself. System partitions occupy a certain amount of space in it, in response to "What does S=40% SE=10% and so on mean?" there is an example of how it works inside. So, perhaps your firmware weighs a lot, and there is simply not enough space in the super itself, you can fix it if you know what you are doing, you need to remove any garbage, applications from the system partitions.
"/" is system, including "/system/
"/vendor" is a vendor, including "/system/vendor", with the rest of the sections in the same way by analogy. Some partitions have a different mount point, this can be viewed in your fstab, it is located along the path /vendor/etc/*fstab*.
So, you first need to delete something from the system partitions, after which, according to the configuration in RO2RW (it is available in config.txt inside the archive, or in the first choice when installing where "max expansion"), distribute the size according to percentages or a fixed size, i.e. flash ro2rw again, or generate rw-super one more time.


Will RW disappear after the OTA software update?

- Yes, in this case, after OTA, you need to boot into the system first, the process will take place, re-mark super for new data, after that you can make a new super through the system or through TWRP:
1. OTA installation
2. Reboot into the system
3. Preparing a new super, or rebooting in TWRP
4. Installing a new super via fastboot, or firmware the archive inside TWRP

How to flash a file via fastboot?

- You need to move the finished file from the phone to the PC, throw RW-super.img into the folder with fastboot/adb, switch to fastboot mode on the phone, and enter the command in the console on the PC "fastboot flash super RW-super.img".
Read more about using fastboot in the branch of your device.

What are the differences between the first 4 options and the rest when first selected in the script?

- The first four expand the sections based on the maximum size of the super, the rest expand on a fixed scale for each section, for example, it is more logical for OnePlus to choose one of the first 4, since there are a lot of sections, about 8, and it will be very large size to expand each by the same 200 MB.

I cannot delete or modify files from /system/app or from /product/app or from any other specific directory, but at the same time in this directory or I can create a file, and at the same time in the neighboring directory I can change files, the system is RW, how to fix it?

- This happens due to the non-direct mounting of specific folders, it is called overlay filesystem, more about it here: https://wiki.archlinux.org/title/Overlay_filesystem

It specifically mounts any folder read-only. At the moment, you can delete or change or add to this directory only via TWRP, having previously flashed RO2RW by selecting the LiteRW option.

Or go to the terminal and write the commands:
Code:
su
magisk --path

The last command will show the path to the magisk directory, you will need to follow the path:
"The path that the magisk --path command displayed"/.magisk/mirror/

There will be partitions that Magisk mounts directly; by going to them, you will be able to change files without obstacles from OverlayFS.

I have a device with 32GB of memory, I do not know which option to choose so that the memory does not suffer?

- The super section occupies a fixed size in the device's memory and has already been marked up by the manufacturer, i.e. even if the system takes up a conditional 2 GB, super still takes up all its conditional 6 GB in memory, I wrote above about how memory is distributed in super.

Why does the script at some point ask to delete some applications?

- This means that the firmware weighs a lot, and after conversion to RW, it does not fit into super, my script suggests deleting some system applications, for example, in Chinese miui there are such stupid advertising things as TikTok, MiShop, etc. Applications are removed from temporary partitions that are being prepared for conversion to super, from the installed system you do not delete anything, well, if you only interrupt the process, after installing a new super, naturally the applications will disappear.

So why should I redistribute something, I didn't understand. I don't care how the system distributes its "empty space" there, they are still not used by me for files, because it's still a system partition. Just need RW super in the same form as it is. That's all. Is it possible somehow without distribution?

- No, you can't, because it won't be original anyway, it won't affect user memory, it won't affect the OTA process if the firmware is pumping FullOTA, only the process of light (incremental) updates that weigh from 2mb to 800mb on average will be prohibited, and the process will not become faster. And if you don't care, then don't you care that there is free memory in the system partitions? in any case, you can fix it through the config as you need and give 1% for all partitions, or 10 or less MB for all partitions.
If all the tests turn out to be successful, I will start adding more features to the script, so I'm waiting for the tests, and also please fill out the Google form if RO2RW worked correctly or incorrectly, by doing this you help the development, as well as other people to understand how it works on their device and their ROM

Do not PM me about the script and help without permission, write to the support group



DOWNLOAD - SourceForge
TG Group
Telegram support chat for quick feedback

Donate only TG link https://t.me/mfpupdate/47

Credits:
- Thanks to the first link in a Google search for" e2fsck --help" link for clarification on disabling RO
- Many thanks to my own tests with the super section and the official Google utilits lpdump/lpmake/lpunpack as well as the --help menu for it
- Many thanks to the first Google search result for explaining tune2fs and resize2fs
- Thanks to the Magisk team for the BusyBox and bootctl binary
- Thanks to the kory-vadim with UKA for the make_ext4fs bibary, and thanks help menu make_ext4fs
- Thanks to SKKK for the erofs.unpack binary
- Thanks all test users



Please take the survey for more RO2RW statistics

Also, the entire list from the survey will be available on this table
 
Last edited:

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
Changelog:

Stable Beta 3.7.0.0:
- Fixed non-removable logs. (To delete old logs from versions 3.6.2.1 and below, go to the /data/media/0/NEO.LOGS directory and you can delete them, or in TWRP and delete them
- Changed configuration logic for RW_SIZE and RW_SIZE_MOD parameters
- Changed the logical chain of appearance of SELECT MENU when there was a request for mount2ext4 or continue without mounting
- The logic has been completely redesigned, when in case of unsuccessful mounting, all partitions were not mounted, now everything will be mounted, except for unsuccessful ones during installation, only EXT4 is affected
- Completely redesigned config.txt, a simple one will open it and be surprised
- Now added support for forced start of the script (FOR TWRP), just configure the config as you need, in case of any failure, the script will fall into an error, do not be afraid
- Added a parameter to the config to disable timeout for the volume keys, so that the script does not fall into an error when you do not press the button for a long time

Stable Beta 3.6.2.0:
- Added avbctl for arm32, thanks for providing binaries: brigudav and Bodya-Kolibass

Stable Beta 3.6.1.1:
- Fixed work in arm32
- fixed chcon

Stable Betav3.6.0.0
- Add with only arm32 linker devices support (Support arm32)

Stable Betav3.5
- Added support for OTG and MicroSD
- Added LiteRW for Recovery mode. Some firmware is enough LiteRW
- Added manual configurator inside the script during execution in a running system through the terminal
- Added display of main paths to directories
- Fixed work for encrypted date if it is not available
- Fixed work "check RW and free size"
- Improved LiteRW code compared to LiteRW 3.0

Stable Beta 3.4.2
- Added the ability to check for RW partitions, and for free space in them. Access is available in TWRP and Terminal via termux
- Added the ability to delete pre-delete system applications
- There is an opportunity to choose "Forced deactivation of verivication and verity, or prepare patched vbmeta for manual firmware
- Fixed the work of ignoring the mounting of partitions for checking in the case of ext4
- Fixed code optimization in half of the code, cut the code thanks to universal functions
- Fixed a bunch of issues
- Fixed work install.sh in TWRP, after separating from update-binary
- Fixed work config.txt
- Fixed bash shell operation
- Fixed the calculation of free space in the super section
- Still need Samsung testers for F2FS

Beta 3.3
- Added e2fsck,tune2fs,resize2fs binaries from termux libraries
- Added the ability to ignore additional checks for ext4 systems, because of which images will not be mounted, because of which it is possible to bypass one of the errors in the previous version. But in this case DFE will not be installed
- Another fix for working with F2FS images
- Added an additional method for cases when you need to mount system images to migrate files to a new image, if direct mounting fails, an image dump will be created and it will already be mounted
- Fixed English language in the script
- Added "SKIP" option for DFE, if you don't know what it is, then press SKIP
- Moved to the bash shell, taken from the termux library, now the sh shell built into recovery / android will not be used.
- Executable script is now separated from update-binary
- Other minor fixes
- now u can use commands: RO2RW,ro2rw

Stable Beta 3.2
- Fixed work for F2FS systems, for Samsung. But you need to do additional manipulations for this, for example, to flash a custom kernel according to tests with a Samsung user comes out exactly like this.
- Fixed the problem of detecting an active slot
- The output of files has become with an informative file name like super.sparse.fastboot.active.slot._a.img
- Also, no patches are applied inside the active system, now you need to flash the same vbmeta through the rrecovery, or fastboot, it will also be output as patched and original in the case of a backup
Stable Beta 3.1.1
- Fix modified fstab for F2FS
Stable beta 3.1
- Add dfe (legacy mode) as an additional option
- Fix 55 error and need 9+gb free space for all devices
- Many text inscriptions for users have been corrected and new ones have been added so that users do not swear and understand what is happening

Beta 3.0.4:
- A lot of fixes when converting images
- Fixed a problem when dm-verity sometimes did not turn off
Beta 3.0.3:
- Fixed installation in Magisk
Beta 3.0.2:
- Small fixes
Beta 3.0.1:
- Slightly tweaked the calculator, some problems may have been fixed
Beta 3.0
- Maybe fixed the issue for some OnePlus devices
- Maybe fixed issue for new Samsung devices
- Added the ability to make a backup of the original super inside the custom recovery (TWRP,OFox)
- The methods for converting images from versions 2.8 and 2.9 are combined, and it seems to me that F2FS support has been added, in theory it should work, but testing is needed

Beta 2.9
- The procedure for converting to EXT4.img has been redesigned, there is no longer a need to mount the file system, except in cases where you need to free memory (remove) any garbage from images

Beta 2.8
- Fixed counting and comparison of large numbers for some devices
- Added check for free memory before creating RW-super.img. will loop until there is enough free space
- Added an inscription about updating the script for magisk, if there was an update, then you do not need to restart the system, otherwise it will be said that you need to restart the system
- Added the ability to backup the original super partition, both in row for recovery and sparse for fastboot
- Added extensive log file with output folder /storage/emulated/0/NEO.LOGS a.k.a /sdcard/NEO.LOGS




Beta 2.7
- Fixed a critical issue when the script was interrupted halfway through and was restarted, in which case data from system partitions could be deleted
- Fix metadata read, moved to android-tools binary from termux pkg
- Fix install for magisk with hide magisk app
- Fix calculate size for fixed size like 200-250mb
- Fixed a bug of different binary files in ROM, moved to a single busybox

Beta 2.6
- Added mode for Magisk.
- Fixed some bugs that I don't remember anymore

Beta2.5:
-Fix awk calculate for any device
-add config.txt and added option to expand partitions in % or size Mb

Beta2.4:
-Fix problem with a-only devices or like system partition name when not sustem_a/_b

Beta2.3:
-fix problem when "need -(minus)xxxx Mb free size"

Beta2.2:
-Fix problem when partition have name main or same name

Beta2.1:
- Fix this problem with RW for partition into TWRP ( works )
- nject a crutch for large ROMs to fix the problem ( works with later miui cn on poco f3 )
- Maybe Fix for A-only devices with super partition ( need test )
- Inject binary for disable DM-verity

Beta2:
-first release for test
 
Last edited:

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
Changelog:

Beta 3.0
- Maybe fixed the issue for some OnePlus devices
- Maybe fixed issue for new Samsung devices
- Added the ability to make a backup of the original super inside the custom recovery (TWRP,OFox)
- The methods for converting images from versions 2.8 and 2.9 are combined, and it seems to me that F2FS support has been added, in theory it should work, but testing is needed
 
Last edited:

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
Changelog:
Beta 3.0.4:
- A lot of fixes when converting images
- Fixed a problem when dm-verity sometimes did not turn off
Beta 3.0.3:
- Fixed installation in Magisk
Beta 3.0.2:
- Small fixes
Beta 3.0.1:
- Slightly tweaked the calculator, some problems may have been fixed
 

Techguy777

Senior Member
Just flash the zip in recovery?
Good luck getting all the the instructions it is never just flash zip with this stuff and the telegram thread or whatever is probably the hardest telegram thread to figure out in all of telegram. I have over 200 telegram threads I watch normally you'll have pinned messages with download and another pinned message with instructions a to z laid. Not this guy you'll have to figure out the puzzle that is his way of doing things
 

TheGhost1951

Senior Member
Feb 11, 2009
1,181
247
Garfield
OnePlus 9 Pro
Good luck getting all the the instructions it is never just flash zip with this stuff and the telegram thread or whatever is probably the hardest telegram thread to figure out in all of telegram. I have over 200 telegram threads I watch normally you'll have pinned messages with download and another pinned message with instructions a to z laid. Not this guy you'll have to figure out the puzzle that is his way of doing things
That is one of the reasons I trust lebigmac script, he is through and instructions are clear!
 

Techguy777

Senior Member
That is one of the reasons I trust lebigmac script, he is through and instructions are clear!
I have been into xda now for about 6 or 7 years. I was edger to learn and even built 3 custom roms back in android 9. Every year or 2 now google makes changes that are huge changes and I still find myself having to learn things like day 1 at times. The new EROFS kernels and roms is brand new I have no idea how they work. F2FS is samsung and thats one of the reasons I was interested because I have a tab s8 plus. The problem is for this to work it makes a copy of your super partition your system. I was trying to figure all of that out and they get pissed you dont understand all of it already. Well I tried flashing it on poco f3 because I thought I was on a RO rom because of EROFS and it failed and I had 13gb of img files in a couple of folders. It requires a lot of free space and if people have there phone filled up and start flashing it will fill it all the way up depending on how big your system is compared to storage. That should be mentioned its not.
 

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
Good luck getting all the the instructions it is never just flash zip with this stuff and the telegram thread or whatever is probably the hardest telegram thread to figure out in all of telegram. I have over 200 telegram threads I watch normally you'll have pinned messages with download and another pinned message with instructions a to z laid. Not this guy you'll have to figure out the puzzle that is his way of doing things
Just flash the zip in recovery?
I have been into xda now for about 6 or 7 years. I was edger to learn and even built 3 custom roms back in android 9. Every year or 2 now google makes changes that are huge changes and I still find myself having to learn things like day 1 at times. The new EROFS kernels and roms is brand new I have no idea how they work. F2FS is samsung and thats one of the reasons I was interested because I have a tab s8 plus. The problem is for this to work it makes a copy of your super partition your system. I was trying to figure all of that out and they get pissed you dont understand all of it already. Well I tried flashing it on poco f3 because I thought I was on a RO rom because of EROFS and it failed and I had 13gb of img files in a couple of folders. It requires a lot of free space and if people have there phone filled up and start flashing it will fill it all the way up depending on how big your system is compared to storage. That should be mentioned its not.
I have added a FAQ, if there are any more questions, I will expand the FAQ
 
  • Like
Reactions: IamTheBRAVE

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
Update to Stable beta 3.1
- Add dfe (legacy mode) as an additional option
- Fix 55 error and need 9+gb free space for all devices
- Many text inscriptions for users have been corrected and new ones have been added so that users do not swear and understand what is happening
 

Ranger2060

Member
Jan 8, 2014
17
5
I have used your Script with TWRP at Xiaomi Redmi Note 10 Pro (#sweet) and it works perfectly, partitions are both readable and writable.
Many thx (y)
 
  • Like
Reactions: LeeGarChat

immortalwon

Member
Mar 11, 2017
42
5
I used your script with TWRP as well on OnePlus Pro 9 in combination with lebigmac's script because his script doesn't make all folders / files in the main root storage R/W. Your script helped make it possible.

My main concern: In TWRP, if I try to place any file I backed up from the system to a folder / file that is usually R/O, I get Error:1 in twrp for a simple copy and paste job. Any reason for this? Sorry I am not an expert in android file systems.
 

LeeGarChat

Senior Member
Jun 24, 2014
137
173
Xiaomi Poco F3
I used your script with TWRP as well on OnePlus Pro 9 in combination with lebigmac's script because his script doesn't make all folders / files in the main root storage R/W. Your script helped make it possible.

My main concern: In TWRP, if I try to place any file I backed up from the system to a folder / file that is usually R/O, I get Error:1 in twrp for a simple copy and paste job. Any reason for this? Sorry I am not an expert in android file systems.
Need after mount partitions "mount -o rw,remount /system_root" for system. "mount -o rw,remount /vendor" for vendor and etc partitions.
Go to advance menu, mount. Mount all parts.
Go to advance menu. Terminal and write this commands
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Changes in the latest release: Stable Beta 3.7.0.0:

    - Fixed non-removable logs. (To delete old logs from versions 3.6.2.1 and below, go to the /data/media/0/NEO.LOGS directory and you can delete them, or in TWRP and delete them
    - Changed configuration logic for RW_SIZE and RW_SIZE_MOD parameters
    - Changed the logical chain of appearance of SELECT MENU when there was a request for mount2ext4 or continue without mounting
    - The logic has been completely redesigned, when in case of unsuccessful mounting, all partitions were not mounted, now everything will be mounted, except for unsuccessful ones during installation, only EXT4 is affected
    - Completely redesigned config.txt, a simple one will open it and be surprised
    Конфиг.png
    - Now added support for forced start of the script (FOR TWRP), just configure the config as you need, in case of any failure, the script will fall into an error, do not be afraid
    photo_2023-01-03_05-06-50 (4).jpg
    photo_2023-01-03_05-06-50 (3).jpg
    photo_2023-01-03_05-06-50 (2).jpg
    photo_2023-01-03_05-06-50.jpg
    - Added a parameter to the config to disable timeout for the volume keys, so that the script does not fall into an error when you do not press the button for a long time
    2
    Thank you lebimac and r kelley

    As recognition tends to be quite important for developers (although i do believe it's not so important for LeeGarChat) this might be the right place to say:

    thank you LeeGarChat for:
    - being an open source developer, so i do not even need to trust you to use your script and afraid of doing something nasty with my p;hone. Furthermore this way it's quite transparent what you've achieved.
    - keeping your code quite organized considering that this is a bash script not a Java code. 1 method does 1 thing only (what the method name says) and does it well.
    - that it's clear you've got the knowledge for what you are doing still try being humble (i see it's not easy :)).
    - that your script is quite close to a comprehensive solution for a problem, has many options and just works well.
    - etc...

    I see you do not like documenting, but to be honest,. i have not seen a good developer who likes documenting his code.
    The current FAQ is enough for me.
    If you do not have time, less documentation and better code quality is always better for these kind of non-proprietary scripts. I always read these types of scripts before i run them, or at the latest when something unwanted happens.
    All i want is to swap YouTube and YT Music to reVanced without any additional features... i suspect your code will be able help me in this soon.

    Cheers.
    1
    So.......what specific selections am I suppose to select when flashing this? I will be using TWRP (Unofficial). My device is OnePlus 8T Global (converted from T-Mobile) A13 F_15.
    Fastboot sparse
    1
    It seems works now, thanks! As there is no working TWRP for Xperia 5II, I used
    for wipe. And finaly I've flashed boot.img with Magisk once again, just in case.
    Device boots and works. I've deleted one app from system folder withount any issues.
    But some apps are in /oem/app and Root Explorer can't delete them. Is /oem/app in Read-only mode still?
    1
    I've just select "Continue"
  • 6

    Read Only to Read Write for android (RO2RW)

    Update 03.01.2023 : Stable Beta v 3.7.2.1

    The first truly working script, original and unique in its logic for all devices with a SUPER partition

    Universal auto RO2RW | EROFS-2-RW | F2FS-2-RW by LeeGarChat

    27013307.png


    photo_2022-12-05_14-01-11 (1).jpg
    photo_2022-12-05_14-01-13 (1).jpg


    Short description:
    Converts EROFS, EXT4(RO), F2FS Super partition to RW

    Description:
    A simple utility to convert your Super partition to RW mode (Read/Write) As well as the expansion and distribution of free space for each section, depending on how much space is available in the original Super section.
    You can flash both via:
    1. TWRP: by using controls in the script: (Volume control (+) to switch, Volume control (-) to select) in this case, the new super RW is flashed directly.
    2. Magisk module: in this case you will need to go to the terminal and enter RO2RW, and a new RW-super.img will be prepared in the internal memory, you can choose both image output for FASTBOOT and RECOVERY.
    For these two modes, the creation of the original super as a backup is supported, the file will also be output to the internal memory as bak-super.img

    Do I need to format the data after installation?

    - No, it is not necessary in normal cases, this script does not affect encryption in the data section. But in some cases, it is necessary to do the date format, it is not yet clear how this is related, for example on Asus devices.


    Why do I need this script, for what and why; why do I, need it?

    - When your system partitions have read-only mode (RO), then you cannot integrate modifications directly into the firmware, (such as Viper4Android) as well as manually edit/delete files from system partitions. This script converts it in the case of F2FS and EROFS to EXT4, or forcibly in the case of EXT4 enables the "Read/Write" (RW) mode, and also expands partitions as much as possible.

    What are systems partitions?

    What are system partitions?
    - These are the sections that are located in the main container "super" (the script is focused only on devices with super), it includes system, product, vendor, etc., when mounting the system, the structure looks like this:
    System <--- In TWRP it is mounted as /system_root
    , in the system itself it is mounted as
    Code:
    / <--- The main mount point for system
    ├── /product <--- The main mount point for product
    ├── /vendor <--- The main mount point for vendor                            
    |
    ├── /system <--- Here are the main system files
    │   │
    │   ├── /system/vendor <--- Additional mount point for vendor
    │   │
    │   ├── /system/product <--- Additional mount point for product

    And by analogy with product and system, all other partitions, or other mount points. This can be viewed in the fstab file located in vendor/etc/
    Some files cannot be edited at the root, or even if they can be edited without RW, those modifications won't stick, because these are temporary files responsible for the operation of the kernel and the entire linux system, in this case android. For example, proc, or sys, if you open a clean image, or mount a system image, you will see that these folders are empty, and files appear there only after the system is started.

    Is ROOT required?

    - If you want to prepare a new super partition inside the system, then you need it, the firmware via TWRP does not need root.

    How does the script work in Magisk?

    - You need to install the archive via Magisk manager as a module, the script will tell you if you need to restart the device. Next, you need to launch the terminal and give it root rights with the command "su", Then enter the command "RO2RW" and the script will run, it will prepare an image of RW-super.img according to your choice and optionally backup the original super bak-super.img, these files will be located in internal memory, after which you need to them to a PC if it is a fastboot image, or flash it via TWRP as super img if the images are for recovery.

    What does S=40% SE=10% and so on mean?

    - This is the distribution of free space in the super between the partitions 'System=S' 'Product=P' 'System_ext=SE' 'Vendor=V' 'Other sections are there they are= OT'
    - For example: The whole system occupies a conditional 4.7 GB. The super partition always has a fixed size in the memory block on the device, for example, take the example with PocoF3, it has 8.5GB there

    Code:
    Super size 8.5-GB
    {1111111111,111111111111,111111111,11111,11111111,111111111111111,000000000000000}
       System    System_ext   Product   Odm   Vendor   Others if any   Unused memory
      2.2/2.2G   0.5/0.5G     0.8/0.8G  7/7M  1.2/1.2G    1/1GB           3.8~G
    - As you can see, there is unused space for the second slot in the section (In 99.99% of cases it is not needed for users with root), and we can use this space for expansion of the partitions, and for system, 40% of this free space will be distributed. For system_ext 10%, for other partitions, if there are any, conditional 10% will be divided between all of them

    RO2RW worked correctly, and the system started, but I can't delete or change files, what is the reason?

    - Perhaps you have some Magisk module installed that prevents you from doing this, for example OverlayFS.
    Also, the reason may be that your device is of the MTK family, in some models there is a restriction at the kernel level for changing system partitions, and therefore mounting in RW, you will not even be able to reinstall magisk on such devices from the system
    In this case, you open the way only to modding via TWRP

    Also, you need to use the latest version of a normal file manager, these are the ones I recommend:
    Solid Explorer File Manager
    Root Explorer
    MT manager

    RO2RW worked correctly, the system started, but in any section, for example vendor, there is little free space available, 2-10mb, can it be expanded somehow?

    In- That's how it will not be possible to expand a lot, this is due to the limitation of space in the super itself. System partitions occupy a certain amount of space in it, in response to "What does S=40% SE=10% and so on mean?" there is an example of how it works inside. So, perhaps your firmware weighs a lot, and there is simply not enough space in the super itself, you can fix it if you know what you are doing, you need to remove any garbage, applications from the system partitions.
    "/" is system, including "/system/
    "/vendor" is a vendor, including "/system/vendor", with the rest of the sections in the same way by analogy. Some partitions have a different mount point, this can be viewed in your fstab, it is located along the path /vendor/etc/*fstab*.
    So, you first need to delete something from the system partitions, after which, according to the configuration in RO2RW (it is available in config.txt inside the archive, or in the first choice when installing where "max expansion"), distribute the size according to percentages or a fixed size, i.e. flash ro2rw again, or generate rw-super one more time.


    Will RW disappear after the OTA software update?

    - Yes, in this case, after OTA, you need to boot into the system first, the process will take place, re-mark super for new data, after that you can make a new super through the system or through TWRP:
    1. OTA installation
    2. Reboot into the system
    3. Preparing a new super, or rebooting in TWRP
    4. Installing a new super via fastboot, or firmware the archive inside TWRP

    How to flash a file via fastboot?

    - You need to move the finished file from the phone to the PC, throw RW-super.img into the folder with fastboot/adb, switch to fastboot mode on the phone, and enter the command in the console on the PC "fastboot flash super RW-super.img".
    Read more about using fastboot in the branch of your device.

    What are the differences between the first 4 options and the rest when first selected in the script?

    - The first four expand the sections based on the maximum size of the super, the rest expand on a fixed scale for each section, for example, it is more logical for OnePlus to choose one of the first 4, since there are a lot of sections, about 8, and it will be very large size to expand each by the same 200 MB.

    I cannot delete or modify files from /system/app or from /product/app or from any other specific directory, but at the same time in this directory or I can create a file, and at the same time in the neighboring directory I can change files, the system is RW, how to fix it?

    - This happens due to the non-direct mounting of specific folders, it is called overlay filesystem, more about it here: https://wiki.archlinux.org/title/Overlay_filesystem

    It specifically mounts any folder read-only. At the moment, you can delete or change or add to this directory only via TWRP, having previously flashed RO2RW by selecting the LiteRW option.

    Or go to the terminal and write the commands:
    Code:
    su
    magisk --path

    The last command will show the path to the magisk directory, you will need to follow the path:
    "The path that the magisk --path command displayed"/.magisk/mirror/

    There will be partitions that Magisk mounts directly; by going to them, you will be able to change files without obstacles from OverlayFS.

    I have a device with 32GB of memory, I do not know which option to choose so that the memory does not suffer?

    - The super section occupies a fixed size in the device's memory and has already been marked up by the manufacturer, i.e. even if the system takes up a conditional 2 GB, super still takes up all its conditional 6 GB in memory, I wrote above about how memory is distributed in super.

    Why does the script at some point ask to delete some applications?

    - This means that the firmware weighs a lot, and after conversion to RW, it does not fit into super, my script suggests deleting some system applications, for example, in Chinese miui there are such stupid advertising things as TikTok, MiShop, etc. Applications are removed from temporary partitions that are being prepared for conversion to super, from the installed system you do not delete anything, well, if you only interrupt the process, after installing a new super, naturally the applications will disappear.

    So why should I redistribute something, I didn't understand. I don't care how the system distributes its "empty space" there, they are still not used by me for files, because it's still a system partition. Just need RW super in the same form as it is. That's all. Is it possible somehow without distribution?

    - No, you can't, because it won't be original anyway, it won't affect user memory, it won't affect the OTA process if the firmware is pumping FullOTA, only the process of light (incremental) updates that weigh from 2mb to 800mb on average will be prohibited, and the process will not become faster. And if you don't care, then don't you care that there is free memory in the system partitions? in any case, you can fix it through the config as you need and give 1% for all partitions, or 10 or less MB for all partitions.
    If all the tests turn out to be successful, I will start adding more features to the script, so I'm waiting for the tests, and also please fill out the Google form if RO2RW worked correctly or incorrectly, by doing this you help the development, as well as other people to understand how it works on their device and their ROM

    Do not PM me about the script and help without permission, write to the support group



    DOWNLOAD - SourceForge
    TG Group
    Telegram support chat for quick feedback

    Donate only TG link https://t.me/mfpupdate/47

    Credits:
    - Thanks to the first link in a Google search for" e2fsck --help" link for clarification on disabling RO
    - Many thanks to my own tests with the super section and the official Google utilits lpdump/lpmake/lpunpack as well as the --help menu for it
    - Many thanks to the first Google search result for explaining tune2fs and resize2fs
    - Thanks to the Magisk team for the BusyBox and bootctl binary
    - Thanks to the kory-vadim with UKA for the make_ext4fs bibary, and thanks help menu make_ext4fs
    - Thanks to SKKK for the erofs.unpack binary
    - Thanks all test users



    Please take the survey for more RO2RW statistics

    Also, the entire list from the survey will be available on this table
    3
    Changes in the latest release: Stable Beta 3.7.0.0:

    - Fixed non-removable logs. (To delete old logs from versions 3.6.2.1 and below, go to the /data/media/0/NEO.LOGS directory and you can delete them, or in TWRP and delete them
    - Changed configuration logic for RW_SIZE and RW_SIZE_MOD parameters
    - Changed the logical chain of appearance of SELECT MENU when there was a request for mount2ext4 or continue without mounting
    - The logic has been completely redesigned, when in case of unsuccessful mounting, all partitions were not mounted, now everything will be mounted, except for unsuccessful ones during installation, only EXT4 is affected
    - Completely redesigned config.txt, a simple one will open it and be surprised
    Конфиг.png
    - Now added support for forced start of the script (FOR TWRP), just configure the config as you need, in case of any failure, the script will fall into an error, do not be afraid
    photo_2023-01-03_05-06-50 (4).jpg
    photo_2023-01-03_05-06-50 (3).jpg
    photo_2023-01-03_05-06-50 (2).jpg
    photo_2023-01-03_05-06-50.jpg
    - Added a parameter to the config to disable timeout for the volume keys, so that the script does not fall into an error when you do not press the button for a long time
    2
    Just flash the zip in recovery?
    Good luck getting all the the instructions it is never just flash zip with this stuff and the telegram thread or whatever is probably the hardest telegram thread to figure out in all of telegram. I have over 200 telegram threads I watch normally you'll have pinned messages with download and another pinned message with instructions a to z laid. Not this guy you'll have to figure out the puzzle that is his way of doing things
    2
    Good luck getting all the the instructions it is never just flash zip with this stuff and the telegram thread or whatever is probably the hardest telegram thread to figure out in all of telegram. I have over 200 telegram threads I watch normally you'll have pinned messages with download and another pinned message with instructions a to z laid. Not this guy you'll have to figure out the puzzle that is his way of doing things
    That is one of the reasons I trust lebigmac script, he is through and instructions are clear!
    2
    RO2RW Update Betav3.3

    Changelog:
    - Added e2fsck,tune2fs,resize2fs binaries from termux libraries
    - Added the ability to ignore additional checks for ext4 systems, because of which images will not be mounted, because of which it is possible to bypass one of the errors in the previous version. But in this case DFE will not be installed
    - Another fix for working with F2FS images
    - Added an additional method for cases when you need to mount system images to migrate files to a new image, if direct mounting fails, an image dump will be created and it will already be mounted
    - Fixed English language in the script
    - Added "SKIP" option for DFE, if you don't know what it is, then press SKIP
    - Moved to the bash shell, taken from the termux library, now the sh shell built into recovery / android will not be used.
    - Executable script is now separated from update-binary
    - Other minor fixes
    - now u can use commands: RO2RW,ro2rw