Difference between revisions of "Backing Up via Rsync"

From WebOS Internals
Jump to navigation Jump to search
Line 59: Line 59:
  
 
==Setting up the host==
 
==Setting up the host==
1. On the host, you will need to create a directory where the Palm Pre will back up the files. My example will be '''/media/pre-backup'''
+
1. Make sure you are the root user.
 +
sudo -i
 +
or
 +
su -l
  
 +
2. On the host, you will need to create a directory where the Palm Pre will back up the files. My example will be '''/media/pre-backup'''
 +
mkdir /media/backup
  
 +
3. If you want to exclude any directories you are already backing up (or simply don't want to include), add --exclude=/path/to/your/dir after "-stats" in the command (in Step 4). You will need to do this for every directory you wish to NOT include in the transfer.
  
 +
4. Fill your IP Address in the command below, along with your excludes (if you have any), and begin the transfer from the host computer.
 +
rsync -HrlptgoDPvvS --progress --force --delete --del --stats rsync://root@IPADDRESS/root /media/pre-backup
  
*3a. (This is informational, skip to 'Setting up the host') To kill the rsync daemon, you will need to find the Process ID first, then kill the process.
+
==Disabling the rsync daemon on the Pre==
  
  #ps auxw | grep rsync  
+
1. You need to disable the rsync daemon on the Pre to prevent anyone from gaining access to your files. To kill the rsync daemon, you will need to find the Process ID first, then kill the process.
 +
 
 +
  ps auxw | grep rsync  
 
  root    11567  0.0  0.0  10480  624 ?        Ss  09:18  0:00 rsync --daemon
 
  root    11567  0.0  0.0  10480  624 ?        Ss  09:18  0:00 rsync --daemon
  root    11576  0.0  0.0  6124  640 pts/1    S+  09:18  0:00 grep rsync
+
  root    11576  0.0  0.0  6124  640 pts/1    S+  09:18  0:00 grep rsync (IGNORE THIS ONE)
  
 
Then kill the process
 
Then kill the process

Revision as of 17:43, 21 July 2009

Synopsis

The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network link, using an efficient checksum-search algorithm.

Some of the additional features of rsync are:

  • support for copying links, devices, owners, groups and permissions
  • exclude and exclude-from options similar to GNU tar
  • a CVS exclude mode for ignoring the same files that CVS would ignore
  • can use any transparent remote shell, including rsh or ssh
  • does not require root privileges
  • pipelining of file transfers to minimize latency costs
  • support for anonymous or authenticated rsync servers (ideal for mirroring)

Background & Purpose

Using rsync as a means to make full backups of the Pre, both for disaster recovery and convenience. I have been using Rsync as a means to backup all my Gentoo and FreeBSD servers, and even a 4TB volume on our NetApp. I was able to restore every system simply by using rsync to push the files to a new disk. Using a special string of commands, rsync backups are nearly as depth-oriented as 'dd', while still being much more convenient.

Requirements

  • 1 Linux-based computer (with access to the same WIFI or usbnet subnet as the Pre)
  • On your Palm Pre, you need to have access to linux and have completed the next steps after accessing linux.

The rsync binary is part of Palm's original package, so it is possible to make a wrap-around gui-based ipk for users who do not want access to linux.

Backup Procedure

Notice

Out of respect for Sprint, I will only document how to use rsync via WIFI or usbnet. I strongly disadvise against using rsync over EVDO (even through SSH). It is bandwidth intensive and we don't want Sprint complaining to Palm.

Quick Overview

1. We will set up the rsync daemon on the Palm Pre and make it acccessible by the host.

2. The host will be set up to download the Pre's files.

3. The transfer will take place.

4. The daemon on the Pre will be killed to prevent anyone else from gaining access.

Setting up the Pre

1. Access your Pre via WIFI or usbnet.

2. Edit /etc/rsyncd.conf and make sure you fill in the host IP address (your computer).

pid file = /var/run/rsyncd.pid
uid = root
gid = root
hosts allow = FILL_YOUR_HOST_IP_HERE
hosts deny = *
use chroot = no

[root]
 path = /

3. To start the rsync daemon, type:

rsync --daemon

Setting up the host

1. Make sure you are the root user.

sudo -i

or

su -l

2. On the host, you will need to create a directory where the Palm Pre will back up the files. My example will be /media/pre-backup

mkdir /media/backup

3. If you want to exclude any directories you are already backing up (or simply don't want to include), add --exclude=/path/to/your/dir after "-stats" in the command (in Step 4). You will need to do this for every directory you wish to NOT include in the transfer.

4. Fill your IP Address in the command below, along with your excludes (if you have any), and begin the transfer from the host computer.

rsync -HrlptgoDPvvS --progress --force --delete --del --stats rsync://root@IPADDRESS/root /media/pre-backup

Disabling the rsync daemon on the Pre

1. You need to disable the rsync daemon on the Pre to prevent anyone from gaining access to your files. To kill the rsync daemon, you will need to find the Process ID first, then kill the process.

ps auxw | grep rsync 
root     11567  0.0  0.0  10480   624 ?        Ss   09:18   0:00 rsync --daemon
root     11576  0.0  0.0   6124   640 pts/1    S+   09:18   0:00 grep rsync (IGNORE THIS ONE)

Then kill the process

kill 11567


Contributor(s)

  • hopspitfire