[HOW-TO]Create Custom ODIN Images for Backup/Restore

Search This thread

mike0jj

Member
Jul 31, 2013
19
3
I got problem with odin fail to flash after dumping my system image. What I noticed is that, the image size is the whole partition size, not the actual used space in the partition itself..!!
However kernel file dumped and flashed by odin correctly since its size = actual used size = partition size.

Any idea on how to dump only the used space in the partition? or at least how to solve this problem.

Thanks in advance.
 

evrkusd

Senior Member
Nov 18, 2013
157
15
New York
Working on doing this for my galaxy tab 2. I'm hoping to be able to pull and flash the custom app and system settings.

Couple of questions:
If I pull and flash the /data partition (userdata.img), will that contain all of the app and system settings?

After I flash the custom /data partition, will the custom app settings remain after a hard reset? I'm hoping this works like the system image, where anything you flash becomes the default after a hard reset..
 
Last edited:

evrkusd

Senior Member
Nov 18, 2013
157
15
New York
Working on doing this for my galaxy tab 2. I'm hoping to be able to pull and flash the custom app and system settings.

Couple of questions:
If I pull and flash the /data partition (userdata.img), will that contain all of the app and system settings?

After I flash the custom /data partition, will the custom app settings remain after a hard reset? I'm hoping this works like the system image, where anything you flash becomes the default after a hard reset..

Still wondering about these, anyone know?

Also, pulling the userdata.img might be problematic, since I don't think the entire thing fits on the sdcard, so I'm hoping to pull it directly to my computer via usb, if that's possible.
 

ChingghisKhan

Senior Member
Hi, I need some help please in identifying my partitions.

I have enclosed an Excel Sheet which lists the partions but I have not been able figure out all of them.
KERNEL, RECOVERY & DBDATA are the ones I need to find.
Any help is highly appreciated.

Thanks
 
Last edited:

xzen

New member
May 13, 2011
4
0
Files on another rom Galaxy Core Prime

My phone galaxy core prime SM_G360M with rom is Knox 2.2 Android v 4.4.4
compilation # KTU84P.G360MUBU1AO14
I can't use some commands from root shell because:

system does not exist as file stl10
kernel does not as file bml8,
recovery does not as file bm19
and finally DBData does not as file stl11

I'll thanks in advance any advice...
 

Unixman0x0

Member
Aug 19, 2014
13
0
I am using samsung s3 sch i535 and have no idea about what are my partitions which need to be copied here's the outpute of mount command from adb shell please find me the system, recovery and kernel partitions.
Code:
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,mode=750,gid=1000 0 0
tmpfs /mnt/secure tmpfs rw,seclabel,relatime,mode=700 0 0
tmpfs /mnt/secure/asec tmpfs rw,seclabel,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,
data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,no
dev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=o
rdered 0 0
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,node
v,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ord
ered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,seclabel,nosuid,
nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data
=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/efs /efs ext4 rw,seclabel,nosuid,nodev,no
atime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered
 0 0
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,relatime,uid=1000
,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=low
er,errors=remount-ro 0 0
/data/knox/sdcard /mnt/shell/knox-emulated sdcardfs rw,nosuid,nodev,relatime,uid
=1000,gid=1000,derive=none 0 0
/data/media /mnt/shell/emulated sdcardfs rw,nosuid,nodev,relatime,uid=1023,gid=1
023,derive=legacy,reserved=20MB 0 0
/dev/block/vold/179:33 /mnt/media_rw/extSdCard vfat rw,dirsync,nosuid,nodev,noex
ec,noatime,nodiratime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,c
odepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:33 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,noat
ime,nodiratime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage
=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/mnt/media_rw/extSdCard /storage/extSdCard sdcardfs rw,nosuid,nodev,relatime,uid
=1023,gid=1023,derive=unified 0 0
 

pozidrivphil

Senior Member
Dec 11, 2014
91
31
Hey, Whenever I try this (follwing the instructions by the letter), I get an md5 error in odin. Flashing a straight tar also results in faults. Is this method outdated?
 

Hypexed

Senior Member
Sep 30, 2017
54
4
Melbourne
Hey, Whenever I try this (follwing the instructions by the letter), I get an md5 error in odin. Flashing a straight tar also results in faults. Is this method outdated?

It's not outdated. Just have to make sure all the files are correct. I found also that you must be in the same folder as where your images are to be tarred up. If you tar from a different folder the file names will differ, containing a path, and it will fail.

You can also do a test. Take a working Odin archive, make a copy, and remove the ".md5" extension so that only ".tar " remains on the end. Open it up to check the contents. Now, with your modded archive, do the same. Do the file names match? Are the internal images inside good?

The following is an example that work here. So here I have a recovery.img and a cache.img.ext4 that I pack into an Odin recovery.tar.md5 file. These commands will produce that example here:
Code:
tar -H ustar -c recovery.img cache.img.ext4 > recovery.tar 
md5sum -t recovery.tar >> recovery.tar 
mv recovery.tar recovery.tar.md5
 
  • Like
Reactions: pozidrivphil

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    I'm sure several people will be wanting this information, so I figured I would post it here for everyone. This will allow you to backup your system and create custom Odin images for restore purposes. For anyone unfamiliar with the Samsung system, they use Odin to flash things to the device, much like HTC has RUU and Moto has SBF. Odin files are either .tar files, or .tar.md5 files.

    The .tar.md5 files are .tar files with the md5 checksum added to the end of the file. If you attempt to flash a .tar.md5 file, Odin will automatically check that the contents are what they should be before flashing and proceed with the flash if the md5 is valid, otherwise it will stop.

    In Odin, you should use the PDA button for all flashing. The PIT button may be used as well, if we can get a valid .pit file for the device, but for now, PIT won't be used either. Other than PDA, Start/Reset are the only other buttons you need to worry about.

    Now, on to creating the backup files. First, you will need your device to be rooted (perm or temp root will work), and you also need to have access to terminal on the phone, either via an emulator or adb shell access. To create the backup files, you won't need a Linux/UNIX system, but you will if you want to create a flashable Odin package. The following will output the files on the root of the SDCard, adjust the "of=" path if you want them somewhere else. It will also create the files for the proper filename for Odin as well. So to create the files, here are the commands you will use from root shell (#):

    System:
    Code:
    dd if=/dev/block/stl10 of=/sdcard/factoryfs.rfs bs=4096

    Kernel:
    Code:
    dd if=/dev/block/bml8 of=/sdcard/zImage bs=4096

    Recovery:
    Code:
    dd if=/dev/block/bml9 of=/sdcard/recovery.bin bs=4096

    DO NOT INCLUDE THE FOLLOWING IN ANYTHING BUT A PERSONAL BACKUP
    Cache:
    Code:
    dd if=/dev/block/mmcblk0p3 of=/sdcard/cache.rfs bs=4096

    DBData:
    Code:
    dd if=/dev/block/stl11 of=/sdcard/dbdata.rfs bs=4096

    Data:
    Code:
    dd if=/dev/block/mmcblk0p1 of=/sdcard/movinand.bin bs=4096

    The last three files (cache, dbdata, data) may contain personal information, so do not include these 3 files in anything but a personal backup/recovery package.

    To create a flashable Odin package, you need to pull all of the files off of the phone/sdcard and onto your computer. From there, you use the following to create the package:
    Code:
    tar -H ustar -c factoryfs.rfs recovery.bin zImage > package_name.tar
    md5sum -t package_name.tar >> package_name.tar
    mv package_name.tar package_name.tar.md5

    If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".

    There are other files that may be in Odin packages, but they are protected by Samsung and cannot be dumped properly. The files are the bootloader, secondary bootloader, modems, and .lfs partitions. The files would be boot.bin, Sbl.bin, modem.bin (not sure what it would be for the CDMA/LTE dual modem here), and param.lfs. It however isn't that big of an issue that these can't be dumped as the can't really be altered by normal flashing of the device, and are usually only altered via OTA updates.
    3
    D
    Deleted member 5132789
    The other option would be using Cygwin, but I've never tried it, so it may or may not work.

    cygwin works!

    Edit: Here is how:

    1. Search google for cygwin - download
    2. Run - you will be prompted to get packages - I assumed "archive" was a good place to start - not sure if you need this or not...
    3. When complete you will see a new icon on your desktop - double-click
    4. Be patient as it loads
    5. Copy the files output'ed from first post to same folder on PC
    6. Back in cygwin:
    a. cd x: (where x: is the drive letter of the drive that has the folder with the files)
    b. tar -H ustar -c cache.rfs dbdata.rfs movinand.bin factoryfs.rfs recovery.bin zImage > package_name.tar
    c: md5sum -t package_name.tar >> package_name.tar
    d: mv package_name.tar package_name.tar.md5

    Complete output of commands:

    These files are for the users to personalise their cygwin experience.

    They will never be overwritten nor automatically updated.

    `./.bashrc' -> `/home/UWINKET//.bashrc'
    `./.bash_profile' -> `/home/UWINKET//.bash_profile'
    `./.inputrc' -> `/home/UWINKET//.inputrc'
    `./.profile' -> `/home/UWINKET//.profile'
    Your group is currently "mkgroup". This indicates that neither
    your gid nor your pgsid (primary group associated with your SID)
    is in /etc/group.

    The /etc/group (and possibly /etc/passwd) files should be rebuilt.
    See the man pages for mkpasswd and mkgroup then, for example, run

    mkpasswd -l [-d] > /etc/passwd
    mkgroup -l [-d] > /etc/group

    Note that the -d switch is necessary for domain users.

    user@computer ~
    $ cd h:

    System Volume Information

    user@computer /cygdrive/h
    $ cd downloads

    user@computer /cygdrive/h/downloads
    $ cd charge

    user@computer /cygdrive/h/downloads/charge
    $ cd tarbackup/

    user@computer /cygdrive/h/downloads/charge/tarbackup
    $ tar -H ustar -c cache.rfs dbdata.rfs movinand.bin factoryfs.rfs recovery.bin
    zImage > package_name.tar

    user@computer /cygdrive/h/downloads/charge/tarbackup
    $ md5sum -t package_name.tar >> package_name.tar

    user@computer /cygdrive/h/downloads/charge/tarbackup
    $ mv package_name.tar package_name.tar.md5

    user@computer /cygdrive/h/downloads/charge/tarbackup
    $
    2
    Thanks!

    Thanks for posting this. I'm going to attempt to make a personal backup and then I can factory reset the phone and make a stock version for people to use. I'm haven't installed the update yet either, so I'm hoping this will let people get back to ED1. I've also been playing around with theming using the fascinate community rom theme and ninjamorph to swap files. It'll take a while, but it's currently the only way I feel safe messing with framework-res.
    1
    Will this method work for the Fascinate as well? Just want to verify before I create a paperweight.

    The method will work, but you need to use the proper device locations to dump from. Most things are just the current device -1. I think that cache is the only thing that really moved.
    1
    Works with voodoo.

    Sent from my SCH-I510 using XDA Premium App