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

Search This thread

imnuts

Inactive Recognized Developer
Jul 27, 2007
3,808
3,174
West Chester
www.imnuts.org
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.
 

jism31

Senior Member
Oct 23, 2010
52
0
Thanks for this info imnuts! I unfortunately updated to the new update and would like to go back to rooted but cant until I downgrade.
 

wynalazca

Member
Apr 10, 2009
43
47
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.
 

droidmark

Senior Member
Oct 13, 2010
127
6
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.

I'm definitely looking forward to having a downgrade ROM image to get back to ED1!
 

rami98

Senior Member
Dec 5, 2010
125
25
Troy, MI
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c
 

imnuts

Inactive Recognized Developer
Jul 27, 2007
3,808
3,174
West Chester
www.imnuts.org
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c

The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.
 

MasterRy88

Senior Member
Jan 7, 2011
244
11
Pomona CA
So im going to try and do the voodoo lagfix for the first time ever but I wanted to make a backup. Im on ED2 and NOT rooted so how would I go about making these backups?
 

mypantsaretorn

Senior Member
Oct 7, 2006
120
22
The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.

I tried the above and I keep getting this error message in the command prompt:

'tar' is not recognized as an internal or external command, operable program or batch file.

(I'm trying this on windows 7 professional)

Any help would be appreciated, thanks!
 

rmanaka

Senior Member
Jul 15, 2005
705
54
I tried the above and I keep getting this error message in the command prompt:

'tar' is not recognized as an internal or external command, operable program or batch file.

(I'm trying this on windows 7 professional)

Any help would be appreciated, thanks!

You wouldn't by any chance be trying the "tar" command at a windows command prompt, would you?

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.

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 ">".

Course you might be running Linux in a vmware or Hyper-V environment....hint?

HTH
 

mypantsaretorn

Senior Member
Oct 7, 2006
120
22
Damn! I didn't pay attention to the second part of that sentence! Lol

Thanks for the "hint"..

Sent from my SCH-I510 using XDA App
 
D

Deleted member 5132789

Guest
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
$
 
Last edited by a moderator:
D

Deleted member 5132789

Guest
Hmm flash did not work with my personal data in it - got an error. Created a new .tar file with just factoryfs.rfs recovery.bin and zImage and was able to flash that. TG for TiBu!
 

RaptorMD

Senior Member
May 2, 2010
1,820
228
I plan to get rooted on ED1 so I can get a stock image backed up, and have a clean base to work from. Still getting my head around the odin stuff first.
 

JKChad

Senior Member
Mar 29, 2010
87
11
US of A
Well, I successfully followed all the instructions and have created my first ODIN flashable file, I have not tried to flash it yet. I'm just curious, I pull all the different .rfs, .bin, and zImage on this file and noticed it's about 1.8gb file. Is this normal?

Also, before I try to flash this. Should I have dissable voodoo lagfix and converted back to rfs before I dumped the files?

Thanks for all the help!
 

imnuts

Inactive Recognized Developer
Jul 27, 2007
3,808
3,174
West Chester
www.imnuts.org
Well, I successfully followed all the instructions and have created my first ODIN flashable file, I have not tried to flash it yet. I'm just curious, I pull all the different .rfs, .bin, and zImage on this file and noticed it's about 1.8gb file. Is this normal?

Also, before I try to flash this. Should I have dissable voodoo lagfix and converted back to rfs before I dumped the files?

Thanks for all the help!

Yes, that's normal for it to be so large as dd will dump the partition, including empty space. If you were to compress it with zip or lzma, it'd drop down considerably.

Not sure about the voodoo part as I've never dumped files from an ext4 partition. I don't see any reason why it wouldn't work, but I'd flash with caution and have another working image ready just in case.
 

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