Difference between revisions of "Backup Media Drive over WiFi"

From WebOS Internals
Jump to: navigation, search
Line 53: Line 53:
 
- pbn) perform backup sync now
 
- pbn) perform backup sync now
  
The first backup may take hours.  I was getting 2GB/hour, so plan first run accordingly.  Best to run first full backup while charging phone. If this is successful, setup scheduling.  
+
The first backup may take hours.  I was getting 2GB/hour, so plan first run accordingly.  You should run the first full backup while charging the phone. If this is successful, setup scheduling.  
  
 
'''Scheduling'''
 
'''Scheduling'''
Line 61: Line 61:
 
- sbk) schedule backup
 
- sbk) schedule backup
  
There is an issue with cron that it doesn't run jobs when phone is asleep.  It will sync when you use your phone or if charging.  Am working on it.  If running nightly backups, will need to have your phone charging to run.
+
There is an issue with cron that it doesn't run some jobs when phone is asleep.  It will definitely sync when you use your phone or if charging.  Am working on it.  If running nightly backups, may need to have your phone charging to run, which is likely for most.  You can confirm by checking the backup log in the morning.
  
For now the scheduler only allows to pick one backup hour of the day.  Late night after midnight is recommended as you're likely home (in local WiFi segment).  Be careful not to schedule near time of a reboot, if that is scheduled.  You can manually edit the cron table to meet your needs.  See details at end of page.
+
For now the scheduler only allows to pick one backup hour of the day.  Late night after midnight is recommended as you're likely home (in local WiFi segment).  Be careful not to schedule near time of a scheduled reboot, if that is scheduled.  You can manually edit the cron table to meet your needs.  See details at end of page.
  
 
== Usage Info ==
 
== Usage Info ==
Line 77: Line 77:
 
- If a backup is running on local WiFi at home and you leave with phone in pocket and it switches to EVDO, no problem.  The backup will timeout (2 minutes) and cleanly exit.  It will pickup where it left off on the next scheduled (or manual) run.
 
- If a backup is running on local WiFi at home and you leave with phone in pocket and it switches to EVDO, no problem.  The backup will timeout (2 minutes) and cleanly exit.  It will pickup where it left off on the next scheduled (or manual) run.
  
- Backup skips cryptofs, so does not backup the applications. It's not guaranteed a restore would work, so not going there.
+
- Backup skips cryptofs, so does not backup the applications. It's not likely a restore would work, so not going there.
  
- A backup runs at lowest priority so doesn't impact performance of other apps.  Was running Need For Speed during full backup and not one skip in NFS, very smooth.  Assassins Creed ran great.  Backups may impact load times however since it impacts IO more than CPU, but even load times were decent.  There doesn't appear to be any noticeable performance impact to other webOS usage due to this.  Even cron runs at a lower priority.  
+
- A backup runs at lowest priority so doesn't impact performance of other apps.  Was running Need For Speed during full backup and not one skip in NFS, very smooth.  Assassins Creed ran great.  Backups may impact load times however since it impacts IO more than CPU, but even load times were acceptable.  There doesn't appear to be any noticeable performance impact to other webOS usage due to this.  Even cron runs at a lower priority.  
  
 
- Cool use.  Take a picture, run a backup and it shows up on your Windows PC.  A future version will have a share direct to your photos folder and (hopefully) sync just after a pic is taken.
 
- Cool use.  Take a picture, run a backup and it shows up on your Windows PC.  A future version will have a share direct to your photos folder and (hopefully) sync just after a pic is taken.
Line 85: Line 85:
 
- For now, backup scheduling only sets up to run once a day.  You can manually change the cron entry to meet your needs.
 
- For now, backup scheduling only sets up to run once a day.  You can manually change the cron entry to meet your needs.
  
- This would also likely work with NAS drives that support cifs, as well as Linux/Mac setup to as cifs/samba server.  Just create a backup folder with sharename 'mediabackup' with full read/write permissions.
+
- This would also likely work with NAS drives that support cifs, as well as Linux/Mac/Unix setup as a cifs/samba server.  Just create a backup folder with sharename 'mediabackup' with full read/write permissions.
  
 
== Excluding Files from Backup ==
 
== Excluding Files from Backup ==
  
Edit this file to add any file/dir patterns you don't want to backup, such as music.  It can also be edited from USB drive using a text editor.
+
Edit this file to add any file/dir patterns you don't want to backup, such as music.  It can also be edited from mounted USB drive using a text editor.
  
 
/media/internal/xorgtools/etc/backup-exclude.cfg
 
/media/internal/xorgtools/etc/backup-exclude.cfg
Line 111: Line 111:
 
== Caveats ==
 
== Caveats ==
  
-There is an issue with cron that it doesn't run jobs when phone is asleep.  It will sync when you use your phone or if charging.  Am working on it.  If running nightly backups, will need to have  your phone charging to run at that time.
+
- There is an issue with cron that it doesn't run some jobs when phone is asleep.  It will always sync when you use your phone or if charging.  Am working on it.  If it didn't sync as expected, run a manual sync.  
  
 
- The username and password on the Windows PC cannot have any spaces.  You'll need to use or create an account on Windows that has no spaces for the user id and password.
 
- The username and password on the Windows PC cannot have any spaces.  You'll need to use or create an account on Windows that has no spaces for the user id and password.

Revision as of 17:12, 3 February 2010

Overview

This tool creates scheduled backups of /media/internal (usb media drive) to a Windows computer over WiFi. It could also work with NAS drive/Linux/Mac that is setup for cifs/samba access.

As with all webos-internals solutions, this function comes with no warranty.

How this method works

This uses Xorg Tools to setup the configuration.

It uses webOS existing cifs filesharing and rsync to perform the backup.

In a nutshell, it mounts a Windows fileshare onto webOS device and uses rsync to sync. Cron scheduling is used to automatically run at specified times.

Requirements

You need the following tools/knowledge to use this service...

- A Windows PC with at least 7GB storage available
- Terminal access to phone, or webOS Quick Install
- Need to know the local IP address of the backup PC
- Helps to know how to setup Windows print/filesharing
-- though the xt wizard walks you through setup

How to install

Install Xorg Tools

Paste this in a terminal session or use webOS Quick Install Linux Command line...

cd /tmp && wget -qO- http://dl.dropbox.com/u/3812896/xt.setup | /bin/sh


In Terminal app or in a Terminal session...

- Run 'xt' from linux

Find the IP address of the backup computer before continuing. If you don't know how to find the local IP address on your computer, this is not for you. Use the local IP address, not the WAN address. Best to start with local segment and then once working, tinker with router port forwarding to maybe use over EVDO and external WiFi.

Initial Setup

- plg) plugin menu
- bck) backup menu
- bis) backup initial setup

Follow all instructions very carefully. Re-run bis if you need to change anything.

Once installed, run a manual sync.

Manual Sync

- plg) plugin menu
- bck) backup menu
- pbn) perform backup sync now

The first backup may take hours. I was getting 2GB/hour, so plan first run accordingly. You should run the first full backup while charging the phone. If this is successful, setup scheduling.

Scheduling

- plg) plugin menu
- bck) backup menu
- sbk) schedule backup

There is an issue with cron that it doesn't run some jobs when phone is asleep. It will definitely sync when you use your phone or if charging. Am working on it. If running nightly backups, may need to have your phone charging to run, which is likely for most. You can confirm by checking the backup log in the morning.

For now the scheduler only allows to pick one backup hour of the day. Late night after midnight is recommended as you're likely home (in local WiFi segment). Be careful not to schedule near time of a scheduled reboot, if that is scheduled. You can manually edit the cron table to meet your needs. See details at end of page.

Usage Info

- The first run may take hours depending on amount of data. Best to charge phone while doing the first full backup. I was getting about 2GB/hour.

- Future backup runs with few changes only take about 2-5 minutes to run, depending on total number of files and size of changed/new files.

- If you delete a file on media drive, it will NOT delete on the Windows backup folder. Future versions will allow you to control this.

- If you quit a backup or if disrupted in the middle, no problem. Just run again and it will pickup where it left off.

- If a backup is running on local WiFi at home and you leave with phone in pocket and it switches to EVDO, no problem. The backup will timeout (2 minutes) and cleanly exit. It will pickup where it left off on the next scheduled (or manual) run.

- Backup skips cryptofs, so does not backup the applications. It's not likely a restore would work, so not going there.

- A backup runs at lowest priority so doesn't impact performance of other apps. Was running Need For Speed during full backup and not one skip in NFS, very smooth. Assassins Creed ran great. Backups may impact load times however since it impacts IO more than CPU, but even load times were acceptable. There doesn't appear to be any noticeable performance impact to other webOS usage due to this. Even cron runs at a lower priority.

- Cool use. Take a picture, run a backup and it shows up on your Windows PC. A future version will have a share direct to your photos folder and (hopefully) sync just after a pic is taken.

- For now, backup scheduling only sets up to run once a day. You can manually change the cron entry to meet your needs.

- This would also likely work with NAS drives that support cifs, as well as Linux/Mac/Unix setup as a cifs/samba server. Just create a backup folder with sharename 'mediabackup' with full read/write permissions.

Excluding Files from Backup

Edit this file to add any file/dir patterns you don't want to backup, such as music. It can also be edited from mounted USB drive using a text editor.

/media/internal/xorgtools/etc/backup-exclude.cfg

Use one line for each entry. More info here....

Sample Excludes

Troubleshooting

Permission Errors

If you get permission errors when doing a manual sync, check the following...

- Make sure the Windows backup folder share has 'full control'. On XP, it might say 'allow user to have full access', that must be checked. Must have read/write access to the share.
- Ensure the Windows backup folder sharename is 'mediabackup'. It must be named this.
- In Vista/Win7, go to Advance Settings in Share tab to create a new sharename.
- The Windows user account cannot have a space in the name or password. If so, create a new Windows user/password with no spaces and re-run "backup initial setup". - If you have firewall software, you may need to open ports: 137-139, 445

Caveats

- There is an issue with cron that it doesn't run some jobs when phone is asleep. It will always sync when you use your phone or if charging. Am working on it. If it didn't sync as expected, run a manual sync.

- The username and password on the Windows PC cannot have any spaces. You'll need to use or create an account on Windows that has no spaces for the user id and password.

- The username/password of the Windows PC appear in /etc/fstab. Anyone know how to hide this?

- There's a known issue with backing up non-english unicode filenames (thanks Kyusaku). The rsync in webos doesn't appear to support --conv to do the conversion. The file backs up OK but with garbled filename, which would need to be renamed. Looking to use a more full fledged rsync binary for future release.

- It turns out that the webOS kernel has built in cifs support and samba is not needed. If you were an early tester and installed samba (on or before Jan 31), you can remove unless you're using for other reasons.

ipkg-opt remove samba

Details on what is setup

These are the configuration files involved if you want to make manual changes.

/etc/fstab
/etc/hosts
/var/spool/cron/crontabs/root

How to Remove

Remove the backup setup...
- plg) plugin menu
- bck) backup menu
- rbk) remove all backup setup

This remove the backup related entries in...
/etc/fstab
/etc/hosts
/var/spool/cron/crontabs/root

You can re-install with 'backup initial setup' menu item.

ToDos/Requests/Updates

Please post other ideas and feature requests here.

Here is the PreCentral thread, which also has release notes on new versions.

Alternate Methods/Other Platforms

I chose to do Windows/cifs because that is what most people have available. This could be easily ported to Mac/Linux by just using rsync daemon (cifs not necessary). The sync scripts in /media/internal/xorgtools/plugins can be altered by likely just stripping out the cifs mounting and change the rsync command to talk to the rsyncd on backup computer.

Credits

Thanks much to testers... Vincent Law, navinaq, Kyusaku, rlanza1054