zurchpet

Fixed: How to backup and restore with tar files in ext4

Apr 7th, 2011
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.09 KB | None | 0 0
  1. # Precautions
  2. # --------------------------------------------------
  3. #
  4. # - only tesed with FuguMod >= 2.0 and SpeedMod >= K13D
  5. # - you do all those commands while booted into Recovery Mode
  6. # - be sure to have enough space free on internal SD
  7. # - It restores to ext4-all
  8.  
  9. # Fast one-liners for copy & paste
  10. # --------------------------------------------------
  11. # *** BACKUP ***
  12. mount /dev/block/mmcblk0p1 /mnt/sdcard; mount /dev/block/mmcblk0p2 /data; mount /dev/block/stl10 /dbdata; rm /mnt/sdcard/system.tar /mnt/sdcard/data.tar /mnt/sdcard/dbdata.tar && cd / && tar cvf /mnt/sdcard/system.tar /system && tar cvf /mnt/sdcard/data.tar /data && tar cvf /mnt/sdcard/dbdata.tar /dbdata
  13.  
  14. # *** RESTORE ***
  15. cd / && umount -f /system; umount -f /data; umount -f /mnt/sdcard; umount -f /dbdata; umount -f /cache; /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl9 && /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/mmcblk0p2 && /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl10 && /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl11 && mount /dev/block/mmcblk0p1 /mnt/sdcard; mount /dev/block/mmcblk0p2 /data; mount /dev/block/stl9 /system; mount /dev/block/stl10 /dbdata; mount /dev/block/stl11 /cache; cd / && tar xvf /mnt/sdcard/system.tar && tar xvf /mnt/sdcard/data.tar && tar xvf /mnt/sdcard/dbdata.tar
  16.  
  17. # backup - in adb shell (as root) do:
  18. # --------------------------------------------------
  19. # mount all filesystems
  20. mount /dev/block/mmcblk0p1 /mnt/sdcard
  21. mount /dev/block/mmcblk0p2 /data
  22. mount /dev/block/stl9 /system
  23. mount /dev/block/stl10 /dbdata
  24. # remove older backups
  25. rm /mnt/sdcard/data.tar /mnt/sdcard/system.tar /mnt/sdcard/dbdata.tar
  26. # backup them all to the root of the internal sdcard (make sure enough space is free)
  27. cd /
  28. tar cvf /mnt/sdcard/system.tar /system
  29. tar cvf /mnt/sdcard/data.tar /data
  30. tar cvf /mnt/sdcard/dbdata.tar /dbdata
  31.  
  32. # restore - process
  33. # --------------------------------------------------
  34. # flash stock ROM with Odin/heimdall
  35. # flash fugumod with Odin/heimdall
  36. # reboot recovery - claim root and open a shell
  37. adb root
  38. adb shell
  39. # unmount all filesystems
  40. cd /
  41. umount -f /system
  42. umount -f /data
  43. umount -f /mnt/sdcard
  44. umount -f /dbdata
  45. umount -f /cache
  46. # recreate filesystems (jfs)
  47. /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl9
  48. /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/mmcblk0p2
  49. /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl10
  50. /sbin/mke2fs -J size=4 -T ext4 -b 4096 -O ^resize_inode,^ext_attr,^huge_file /dev/block/stl11
  51. # mount all filesystems and internal sdcard
  52. mount /dev/block/mmcblk0p1 /mnt/sdcard
  53. mount /dev/block/mmcblk0p2 /data
  54. mount /dev/block/stl9 /system
  55. mount /dev/block/stl10 /dbdata
  56. mount /dev/block/stl11 /cache
  57. # restore the tar
  58. cd /
  59. tar xvf /mnt/sdcard/system.tar
  60. tar xvf /mnt/sdcard/data.tar
  61. tar xvf /mnt/sdcard/dbdata.tar
  62. # reboot
  63. reboot bootloader
Advertisement
Add Comment
Please, Sign In to add comment