[YU Yureka Q&A, Help & Troubleshooting] Annabathina:
If you want the hard way in changing ROMs with ****in ".dat" files ****ty thing ("system.new.dat", "system.patch.dat" and "system.transfer.list") to read the new partition size, then you need Ubuntu with the latest kernel (that has the latest patch on "Transparent Compression", see this post), and follow these steps (thanks to xpirt for his guide):

​

Step 1 - Decompressing = DAT (sparse data) -> EXT4 (raw image)

We're now using sdat2img binary, the usage is very simple (make sure you have python 3.x installed):

./sdat2img.py <transfer_list> <system_new_file> <system_ext4>- <transfer_list> = input, system.transfer.list from rom zip

<system_new_file> = input, system.new.dat from rom zip

<system_ext4> = output ext4 raw image file

and a quick example of usage:

./sdat2img.py system.transfer.list system.new.dat system.img
by running this command you will get as output the file my_new_system.img which is the raw ext4 image.

Step 2 - Decompress EXT4 (raw image) -> OUTPUT folder -> Compress EXT4 (raw image)

Now we need to mount or ext4 raw image into an output folder so we can see apks/jars etc. To do this we need to type this command:

sudo mount -t ext4 -o loop system.img output/

As you can see there is a new folder called output which we can edit/modify/delete your files (not able to? see here)

Now we need to compress it back to a raw ext4 image, to do this we need the make_ext4fs binary. Make sure you have the file_contexts file (taken from the Rom zip) inside the make_ext4fs path. Then type this (got issues? see here).

/make_ext4fs -T 0 -S file_contexts -l 2684354560 -a system system_new.img output/

The value of 2684354560 in above code is the new size of system partition in Bytes. Upon doing the above processes, you will get the new raw ext4 image called 'system_new.img' ready for the next step.

Step 3 - Converting = EXT4 (raw image) -> DAT (sparse data)

Now we need the rimg2sdat binary, the usage is very simple:

./rimg2sdat <system_img>

<system_img> = name of input ext4 raw image file

and a quick example of usage:

./rimg2sdat my_new_system.img

As you can see the output is composed by system.transfer.list, (system.patch.dat) & system.new.dat, ready to be replaced inside your Rom zip.

Just to make it really simple

1. Fire up your beloved ubuntu, make sure you have python 3.x installed.

2. Download "sdat2img.py", "make_ext4fs", and "rimg2sdat" binaries, and put it inside a folder (use a file manager for god sake). We can name the folder "****inGreat".

3. Now make an empty folder inside "****inGreat" folder, and name it "output".

4. Extract "system.new.dat", "system.patch.dat", "system.transfer.list", and "file_contexts" from your beloved rom's zip file, and put it inside "****inGreat" folder.

5. Now open "****inGreat" folder with root privilege, then open terminal (we call it cmd in windows) from there.

6. type below code on the terminal (one line at a time):

./sdat2img.py system.transfer.list system.new.dat system.img (press enter)
sudo mount -t ext4 -o loop system.img output/ (press enter)
/make_ext4fs -T 0 -S file_contexts -l 2684354560 -a system system_new.img output/ (press enter)
./rimg2sdat my_new_system.img (press enter)

7. Now copy the new "system.new.dat", "system.patch.dat", "system.transfer.list", and "file_contexts" inside "****inGreat" folder back to your beloved rom's zip file.

8. Flash the rom via TWRP

9. And you are good to go.

10. Ain't that simple!!!!!!!!!!!!!

​

sdat2img.py

- github.com

make_ext4fs

- mega.co.nz

rimg2sdat

- mega.co.nz