webOS Nation Forums >  webOS Developers >  webOS Development > Using Rsync to Do a Complete Backup of Your Pre
Using Rsync to Do a Complete Backup of Your Pre
  Reply
 
Thread Tools Display Modes
Old 10/06/2009, 08:48 PM   #1 (permalink)
Member
 
Posts: 217
So I was trying to find a way to back up my Pre everything from my personal files to installed applications to default applications. Basically every and any file on my Pre. Here is what I found out to work best for me.

*** This also works to copy files from the emulator.***

I have determined the quickest and easiest way for me is to use rsync. Before I get into the steps to backup your Pre there are a few things which need to be done and said.

1.First this works best on Linux and Mac but is possible on Windows. (Only because of ssh setup)
2. You will need a Rooted Pre, this is very very simple and has been written up by many people.
3. You will need a SSH server setup on the comp you want to backup to. Very simple to setup on Linux and Mac. Windows is a little more difficult but still possible.
(windows should look into using OpenSSH or a similar ssh server application.) If you need help with this use your good friend Google!
4. You will need a wireless network or have usbnet set up for your Pre. (go here to find out more about usbnet at USBnet networking setup - WebOS Internals )
5. last but not least this little tutorial.

So once your Pre is rooted, and you have a SSH server set up it is basically a 1 line command that you can manipulate as you need.

1.SSH or novaterm into your Pre making sure you are connected through Wireless or usbnet.
2. run single rsync command:
Code:
rsync -avz --size-only --progress /var/usr/palm/applications/com.palm.app.pdfviewer/ username@SSHServerIP:/home/bob/Pre
what this command does is takes "/var/usr/palm/applications/com.palm.app.pdfviewer/" the pdfviewer application and copies it to SSHServerIP and places it in "/home/bob/Pre".
You can change both of those folders so you can back up any folder on your pre to any folder on your ssh server. it will only copy over files that have been changed since the last backup. So if this is your first it will copy all. if you use this for a 2nd time it will backup 0 files because there are no new files to backup.

Here is an example of the steps after you ssh into your phone. You will see:
root@castle:
1.type in:
Code:
rsync -avz --size-only --progress /var/usr/palm/applications/com.palm.app.pdfviewer/ bob@192.168.1.100:/home/bob/Pre/
2.Will look like:
Code:
root@castle:rsync -avz --size-only --progress /var/usr/palm/applications/com.palm.app.pdfviewer/ bob@192.168.1.100:/home/bob/Pre/
3. Press enter.
4. it will ask you to authorize the host

Code:
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)?
5.Please type 'yes' or 'no': yes

Code:
Warning: Permanently added '192.168.1.100' (RSA) to the list of known hosts.
6. Will ask for password for the user you set up on the ssh server, type it in.

Code:
bob@192.168.1.100's password:
7. After you put in the correct password it will build a list of all the files then begin transferring them and it will look something like this:

Code:
building file list ... 
171 files to consider
./
.project
         263 100%    0.00kB/s    0:00:00 (xfer#1, to-check=169/171)
appinfo.json
         227 100%   55.42kB/s    0:00:00 (xfer#2, to-check=168/171)
framework_config.json
          85 100%   13.83kB/s    0:00:00 (xfer#3, to-check=167/171)
icon.png
        4374 100%  388.32kB/s    0:00:00 (xfer#4, to-check=166/171)
index.html
         655 100%   42.64kB/s    0:00:00 (xfer#5, to-check=165/171)
sources.json
         452 100%   25.97kB/s    0:00:00 (xfer#6, to-check=164/171)
8. Once it is done it will say:

Code:
sent 81107 bytes  received 2758 bytes  4533.24 bytes/sec
total size is 166330  speedup is 1.98
And your app has been backed up.

Here is the rsync command to back up your entire Pre
All Files
Code:
rsync -avz --size-only --progress / username@sshserver:/Directory/To/Backup/To/
All fies except for these folders /proc & /sys
Code:
rsync -avz --size-only --exclude proc/ --exclude sys/ --progress / username@sshserver:/Directory/To/Backup/To/
I have not seen anyone have the back up process written up using this method so I decided I would do it because this was the easiest way for me to backup my Pre.

If you are interested you could even turn this into a script so you dont have to type in the rsync command everytime. This can also be done over your carriers 3g network while you are out and away from the computer.

Last edited by elpollodiablo1; 10/08/2009 at 09:12 PM. Reason: Better formating
elpollodiablo1 is offline   Reply With Quote
Thanked by irateb, ndz, Veritas06
Old 10/06/2009, 09:25 PM   #2 (permalink)
ndz
Member
 
Posts: 113
I use rsync and also grsync (graphical) to back up several Linux machines. It's a great tool. Thanks for the writeup.
ndz is offline   Reply With Quote
Old 10/06/2009, 09:35 PM   #3 (permalink)
Moderator
 
Gaurav's Avatar
 
Posts: 8,277
Wow...yeah I would definitely be interested in a script for this!!! Could the back files them be imported into the emulator somehow?
__________________
_________________
aka Gfunkmagic

Current device: Palm Pre
Device graveyard: Palm Vx, Cassiopeia E100, LG Phenom HPC, Palm M515, Treo 300, Treo 600, Treo 650, Treo 700p, Axim X50v, Treo 800w



Please don't PM me about my avatar. For more info go here.

Restore your Pre to factory settings using webos doctor and follow these instructions
Gaurav is offline   Reply With Quote
Old 10/07/2009, 01:01 AM   #4 (permalink)
Member
 
irateb's Avatar
 
Posts: 257
Just confirming that it will work with OpenSSH installed on a Windows box (Windows Server 2k8). I'm copying from root. Not sure what an entire copy of the Pre gets me, but I'll have it...
irateb is offline   Reply With Quote
Old 10/07/2009, 07:33 AM   #5 (permalink)
Member
 
Posts: 217
Quote:
Originally Posted by Gaurav View Post
Wow...yeah I would definitely be interested in a script for this!!! Could the back files them be imported into the emulator somehow?

Yes it can be then imported into the emulator all you need to do is change the Ip address to localhost and add --rsh='ssh -p8023' to the command and run it from the comp where the files were backup to. so here is an example:

Code:
rsync -avz --size-only --progress --rsh='ssh -p5522' /home/bob/Pre/com.palm.app.pdfviewer/ root@localhost:/var/usr/palm/applications/
This works because the Emulator has ssh already set up on port 5522 for root with out a password required. This example takes the com.palm.app.pdfviewer which you backed up to your computer. and put it into /var/usr/palm/applications/ on your emulator.

Hope this help. I have not tested it so if it does not work let me know and I will try it after work.

Last edited by elpollodiablo1; 10/08/2009 at 08:28 PM.
elpollodiablo1 is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0