Jump to content


Photo

18 Aug: EFS auto backup script (for devs)

- - - - -

  • Please log in to reply
4 replies to this topic

#1
PaulOBrien

PaulOBrien

    It's My Party

  • Founder
  • PipPipPipPipPipPip
  • 36,369 posts
  • Gender:Male
  • Location:Norwich, UK
  • Devices:All the Nexus!
  • Twitter:@paulobrien
I have now seen a number of cases of the EFS partition getting wiped / corrupted on the SGS II, leaving users with an effectively useless phone.

With this in mind, i've written a little init.d script for my ROM which backs up the EFS partition on boot if a backup does not already exist. A non intrusive safety net for users if you will. :)

The script just needs a suitable boot image that runs init.d, although it could easily be tacked onto the end of install-recovery.sh if that's not the case.

I'd love to encourage all developers to use this script for users' sake!

You can download the script here - http://cl.ly/2j0p0R3F07052m2T2u0e - but it's very simple, here's the code...

#!/system/bin/sh
# EFS auto backup script for Samsung Galaxy S II
# By @paulobrien - http://s2.MoDaCo.com

mount /dev/block/mmcblk0p11 /sdcard

if [ ! -f /sdcard/efs.autobackup.img ];
then
        dd if=/dev/block/mmcblk0p1 of=/sdcard/efs.autobackup.img
fi

umount /sdcard
:)

Note the manual mount / umount of sdcard is necessary because this happens late in the boot process.

Cheers!

P

  • 0

You can follow me on Twitter - http://twitter.com/paulobrien / Follow MoDaCo on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

Posted Image


#2
clivec

clivec

    Enthusiast

  • MoDaCo Silver
  • PipPipPip
  • 170 posts
  • Gender:Male
  • Location:The Matrix..
  • Interests:Phones, Amateur Radio, General Techy stuff.
  • Devices:HTC one X, Nexus S
  • Twitter:@clivectmob
As a matter of interest Paul, if it became necessary to restore the efs partition, how do you go about doing it? Is it as described here:

http://forum.xda-dev...d.php?t=1085374

Or would it be different as yours is a .img file?

I've had a bit of a google about, found your thread on the xda devs site, but still no answer about restoring the image. Fastboot maybe?

Sorry if it's a noob question but i'm still learning about these things ;)

  • 0
There is no spoon...

#3
PaulOBrien

PaulOBrien

    It's My Party

  • Founder
  • PipPipPipPipPipPip
  • 36,369 posts
  • Gender:Male
  • Location:Norwich, UK
  • Devices:All the Nexus!
  • Twitter:@paulobrien
You'd 'dd' the image back.

P

  • 0

You can follow me on Twitter - http://twitter.com/paulobrien / Follow MoDaCo on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

Posted Image


#4
clivec

clivec

    Enthusiast

  • MoDaCo Silver
  • PipPipPip
  • 170 posts
  • Gender:Male
  • Location:The Matrix..
  • Interests:Phones, Amateur Radio, General Techy stuff.
  • Devices:HTC one X, Nexus S
  • Twitter:@clivectmob

You'd 'dd' the image back.

P


Ah! Cool, so i'm assuming then that the phone would still be in some sort of bootable state then after corruption. Probably just sim and radio related issues i suppose.

Cheers. Good to know :)

  • 0
There is no spoon...

#5
PaulOBrien

PaulOBrien

    It's My Party

  • Founder
  • PipPipPipPipPipPip
  • 36,369 posts
  • Gender:Male
  • Location:Norwich, UK
  • Devices:All the Nexus!
  • Twitter:@paulobrien

Ah! Cool, so i'm assuming then that the phone would still be in some sort of bootable state then after corruption. Probably just sim and radio related issues i suppose.

Cheers. Good to know :)

Correct! :)

P

  • 0

You can follow me on Twitter - http://twitter.com/paulobrien / Follow MoDaCo on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users