Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Convert DAT System File to EXT4 on Marshmallow & Lollipop

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Converting a DAT system file (like system.dat or system.new.dat) to an EXT4 image lets you modify, mount, or flash a custom Android system partition on devices running Android 5.0 Lollipop or 6.0 Marshmallow. This is commonly needed for ROM developers or advanced users who want to extract or repack system images. You'll need a Linux PC (or Windows with WSL/Cygwin), the original DAT file, and the matching transfer list if it's a .new.dat file. This guide assumes you have basic command-line familiarity.

What You'll Need

  • A Linux PC (or Windows with WSL, Cygwin, or Git Bash).
  • The DAT file (e.g., system.dat or system.new.dat).
  • If using system.new.dat, you also need the system.transfer.list file from the same ROM.
  • Python 2.7 or Python 3 (most tools work with both).
  • A tool like sdat2img (for .new.dat) or dat2img (for older .dat).
  • Basic knowledge of terminal commands.

Step-by-Step

  1. Identify your DAT type. If the file is named system.dat (no .new), it's an older sparse image. If it's system.new.dat, it's a newer Android 5.0+ format that requires a transfer list.
  2. Install required tools. On Ubuntu/Debian, run: sudo apt install python3 python3-pip. Then download sdat2img from a trusted source (e.g., XDA-Developers or GitHub). For older .dat files, download dat2img or use the simg2img tool (part of Android tools).
  3. For system.new.dat: Place system.new.dat and system.transfer.list in the same folder. Run: python3 sdat2img.py system.transfer.list system.new.dat system.img. This will produce a raw EXT4 image named system.img.
  4. For older system.dat: If it's a sparse image, use simg2img system.dat system.img to convert it to a raw EXT4 image. If simg2img fails, try dat2img or manually unsparse it with Python scripts available online.
  5. Verify the output. After conversion, check the file type with file system.img. It should say "Linux rev 1.0 ext4 filesystem data". If not, the conversion may have failed.
  6. Mount the EXT4 image (optional). To access files, create a mount point: mkdir /mnt/system and then sudo mount -o loop system.img /mnt/system. You can now browse or modify files.
  7. Repack if needed. If you modified files and want to create a new DAT, reverse the process: unmount, then use img2sdat (for .new.dat) or img2simg (for sparse) to convert back.

Common Mistakes

  • Using the wrong tool for the DAT type. Running sdat2img on a non-.new.dat file will fail. Always check the filename.
  • Missing the transfer list. For system.new.dat, the system.transfer.list is mandatory. Without it, conversion is impossible.
  • Not enough disk space. The output image is typically 1-2 GB. Ensure you have free space.
  • Forgetting to run Python as root (or with proper permissions). Some tools need write access to the current directory. Use sudo if permission denied.
  • Assuming the output is bootable. An EXT4 image is not a flashable ZIP; it's a raw partition image. You'll need to flash it via fastboot or a custom recovery.

Tips

  • Always back up the original DAT files before converting.
  • Use a dedicated folder for the conversion to avoid clutter.
  • If you're on Windows, install WSL (Windows Subsystem for Linux) to run Linux commands natively.
  • For system.new.dat from Android 5.0/6.0, the transfer list format is consistent; newer Android versions (7.0+) may use a different format, but this guide is for Lollipop/Marshmallow.
  • If you only need to extract a few files, consider using a tool like ext4explorer (Windows) or ext4fuse (Linux) instead of mounting.

Troubleshooting

If the conversion fails or the image doesn't mount, try these in order:

  1. Check the transfer list. Open system.transfer.list in a text editor. The first line should be a version number (e.g., 1 or 2). If it's 2, the tool must support it. Most sdat2img versions do.
  2. Re-download the DAT file. A corrupted download is a common cause. Verify the file size matches the ROM's expected size.
  3. Try a different sdat2img version. Older versions may fail with newer transfer lists. Look for the latest release.
  4. If mounting fails with "wrong fs type", run fsck.ext4 -f system.img to repair filesystem errors. Then try mounting again.
  5. If the image is too large to mount, check your loop device limits: sudo losetup -f and use sudo mount -o loop explicitly.
  6. If you get a Python error, ensure you're using Python 3 (try python3 instead of python). Some tools require Python 2.7; if so, install it.

Frequently Asked Questions

Can I convert a DAT file on a Mac?

Yes, macOS can run Python scripts, but you'll need to install Python and possibly use Homebrew to get necessary tools like simg2img. The steps are the same as Linux.

What's the difference between system.dat and system.new.dat?

system.dat is an older sparse image format used in Android 4.x and earlier. system.new.dat is a compressed image split into chunks, introduced with Android 5.0 Lollipop, and requires a transfer list to reconstruct.

Can I flash the resulting EXT4 image directly via TWRP?

No, TWRP expects a ZIP or a raw image for the system partition. You can flash the EXT4 image using fastboot (fastboot flash system system.img) or by placing it in a TWRP backup folder and restoring it.

Will this work for Android 7.0+ DAT files?

This guide is specific to Lollipop (5.0/5.1) and Marshmallow (6.0). Android 7.0+ uses a different transfer list version and may require updated tools. For those, look for tools that support version 2 or 3 of the transfer list.

Do I need root access on my phone?

No, the conversion happens on your PC. You only need root if you plan to flash the image to your device, which requires an unlocked bootloader.

Is it safe to modify the system image?

Modifying the system partition can cause boot loops or instability. Always keep a backup of your original ROM and only make changes you understand. If you're unsure, stick to extracting files rather than modifying.