Reply
Thread Tools
Posts: 968 | Thanked: 974 times | Joined on Nov 2008 @ Ohio
#1
Just ran into an interesting problem this morning. Rebooted my N900 and plugged the charger in once it hit the Nokia screen.

For some reason when it had finished booting, my contacts/calendar were gone, widgets were all reset to defaults, some weren't showing.

It appears that all or part of my /home/user directory disappeared. Widget settings were gone, etc. All my applications were still installed, but all the settings stored in /user/ were gone.

In particular, the comics widget got reset, pretty annoying to start over reading comics from january (particularly since the comics are in the MyDocs folder. Fortunately, I had a backup from about 2 weeks ago, so I only had to go through the last 2 weeks of comics.

I also had to redo settings for many other programs (ermining, alarmed, etc). Email was ok.

Anyway, I wrote a quick script to backup /home/user (excluding MyDocs), that I can schedule to run through alarmed (or any other scheduling app). It checks to make sure the N900 is charging before running. Just thought I'd post it here for anyone else interested.

I'm sure there are better ways to do this, feel free to modify all you want.

Code:
#! /bin/sh

ischarging=`hal-device bme | grep is_charging | awk '{print $3}'`
if [ $ischarging = "true" ]; then
	tar -cvf /home/user/MyDocs/tmp/user.tar /home/user --exclude "MyDocs"
#	tar -cvf /home/user/MyDocs/tmp/opt.tar /opt
fi
*EDIT* it also has a line to backup /opt as well (obviously)
__________________
*Consumer*, not a developer! I apologize for any inconvenience.
My script to backup /home and /opt
Samsung Galaxy S Vibrant, Huawei S7, N900(retired), N800(retired)
 

The Following 5 Users Say Thank You to lemmyslender For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#2
This is great to use before reflashing. Thanks.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
Posts: 24 | Thanked: 0 times | Joined on Jul 2010
#3
hi lemmyslender

thanks for such a script, and i really would like to backup using this script, but unfortunately, i dont know how to run this script

can you please guide me into running this script, some step by steps procedure
 
Posts: 968 | Thanked: 974 times | Joined on Nov 2008 @ Ohio
#4
Open xterm, create a folder called scripts (mkdir scripts), if you want (Xterm should open in /home/user).

Change to scripts directory (cd scripts).

Open your favorite editor (leafpad, nano, vi) and paste the script into it.

Save the file as backup.sh

Add the execute permission to the backup (chmod +x backup.sh)

Execute the script ( ./backup.sh) It won't work unless your N900 is charging (plugged in).

*Make sure to create a tmp directory in your MyDocs folder if it isn't there already.
*Remove the # to backup /opt as well.

You should see a list of files start scrolling by. It'll take a bit to run depending on the sizes involved.

No warranties expressed, implied, etc.

EDIT -Also, although you can open *.tar files in windows (with the right programs), extracting the files will cause their permissions to be lost. You can use Xarchiver on the N900 to open and extract files.
You should restore files from user.tar as the normal user, files from opt.tar as root. Otherwise, you may screw up permissions on the files.
__________________
*Consumer*, not a developer! I apologize for any inconvenience.
My script to backup /home and /opt
Samsung Galaxy S Vibrant, Huawei S7, N900(retired), N800(retired)

Last edited by lemmyslender; 2010-07-13 at 18:40.
 

The Following User Says Thank You to lemmyslender For This Useful Post:
Posts: 842 | Thanked: 1,197 times | Joined on May 2010
#5
Have you tested trying to restore the /opt/ directory? I'm not sure how well it would work when you have apps running(in the background if nowhere else).

Also, do realize that if you end up restoring to PR1.2, then restore your /opt/ directory, you -will not- be able to use any programs you restored, -unless- you install them all first.
 
Posts: 968 | Thanked: 974 times | Joined on Nov 2008 @ Ohio
#6
Well, I was initially looking to backup /home/user/* as several apps keep settings and files there. Once I got that, I threw in /opt/* for fun. MyDocs can be copied via usb, so I wasn't as worried about that.

I never planned on doing a "full restore" (un-tar back to /opt or /home/user), I was using it more to pick and choose a couple/several files to restore. Given the size (max 2GB) I figured it was easier to do the whole thing, as opposed to guessing what I'd mess up next.

For a while I was doing quite a bit of modding, and occasionally screwed something up. At least a couple times, I was able to go through the backup, pull out a file(s) and replace a corrupted/missing file(s) via ssh.

*I would not recommend doing a full restore, unless you know what you are doing as it may destroy your N900*
__________________
*Consumer*, not a developer! I apologize for any inconvenience.
My script to backup /home and /opt
Samsung Galaxy S Vibrant, Huawei S7, N900(retired), N800(retired)
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:39.