Difference between revisions of "Backup Media Drive over WiFi"

From WebOS Internals
Jump to: navigation, search
(Details on what is setup)
Line 123: Line 123:
 
ipkg-opt remove samba2
 
ipkg-opt remove samba2
  
== Details on what is setup ==
+
== Layout Details ==
These are the configuration files involved if you want to make manual changes.
+
These are the configuration/script files involved if you want to make manual changes.
  
/etc/fstab<br>
+
/media/internal/xorgtools/etc/mediabackup.cfg (stores ip, username, passwd, etc)<br>
/etc/hosts<br>
+
/media/internal/xorgtools/etc/backup-exclude.cfg  (files/dirs to exclude in backup)<br>
/var/spool/cron/crontabs/root
+
/var/spool/cron/crontabs/root (cron schedling)<br>
  
A future version will no longer use /etc/fstab or /etc/hosts and will have its own config file.
+
/media/internal/xorgtools/bck.mnu (the backup menu)<br>
 +
/media/internal/xorgtools/bck (directory of backup scripts)<br>
  
 
== How to Remove ==
 
== How to Remove ==

Revision as of 08:08, 8 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 are 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 (or other cifs/samba server) 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, though it varies, so plan first run accordingly. You should run the first full backup while charging the phone. If this is successful, setup scheduling. If not successful, check Troubleshooting section below.

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 consistently 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 and 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 encrypted .palm directory, 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 will also 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 consistently sync when you use your phone or if charging. Am working on it. Check the backup log. 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 backup maintains timestamps. It will have permission errors on changing times on some '.' directories. Those are harmless errors. Ignore them.

- 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. The optware version of rsync has the --conv flag if you want to install/use that version.

- 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 samba2

Layout Details

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

/media/internal/xorgtools/etc/mediabackup.cfg (stores ip, username, passwd, etc)
/media/internal/xorgtools/etc/backup-exclude.cfg (files/dirs to exclude in backup)
/var/spool/cron/crontabs/root (cron schedling)

/media/internal/xorgtools/bck.mnu (the backup menu)
/media/internal/xorgtools/bck (directory of backup scripts)

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 rsyncd on backup computer.

Credits

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