Editing Manual backup and restore

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
There are several scenarios where you might want to manually backup and restore your [[Nokia N900|N900]]. Using manual methods (as opposed to using osso-backup) is convenient for advanced users (to have more control over their phone), scheduling backups with fcron and the like, starting from scratch (if you want to wipe the phone and restore file-by-file) - because osso-backup can also backup problematic files.
+
There are several scenarios where you might want to manually backup and restore your phone. Using manual methods (as opposed to using osso-backup) is convenient for advanced users (to have more control over their phone), scheduling backups with fcron and the like, starting from scratch (if you want to wipe the phone and restore file-by-file) - because osso-backup can backup also problematic files.
-
This was discussed at [http://talk.maemo.org/showthread.php?t=35037] and [http://talk.maemo.org/showthread.php?t=48488&page=2].
+
This was discussed at [http://talk.maemo.org/showthread.php?t=35037 talk.maemo.org].
-
== Background ==
 
-
 
-
=== Connectivity ===
 
-
 
-
As the USB mass storage mode on the phone does not provide access to the root file system, some other way of transferring backups is required. Therefore, the first prerequisite is a working TCP/IP network between the phone and the target machine. Alternatively, a microSD card could be used.
 
-
 
-
=== Power ===
 
-
 
-
We do not want our backups to drain the phone's battery, so we should only consider running the backup if we are connected to external power.
 
-
 
-
=== Automation ===
 
-
 
-
Once set up, the backups should happen automatically without intervention from the user, BUT complain loudly if they fail. This implies a script that we can schedule from cron that should perform whatever combination of tests and operations we may need. It also implies key-based access to our backup host.
 
-
 
-
=== Snapshots ===
 
-
 
-
At any given time we want a decent ability to backtrack, which means storing regular snapshots using something like rdiff-backup or rsnapshot.
 
-
 
-
So, what we've got so far is that we want to run a script on the N900 that tests whether we have external power (or dies), then tries to get a wireless connection to the backup server (or dies), then performs an incremental backup of the entire phone.
 
==Backup methods==
==Backup methods==
Line 28: Line 9:
This script backs up contacts (database and also exports them with osso-addressbook-backup for safety), conversations, calendar, bookmarks, repository and packages list to external memory card's directory Backup which then contains subdirectories named with date and time when the backup was performed. The path is also definable. For example: "Memory_card/Backup/2010-03-03_00-00". It also displays notification during backup, because it was made to be used with [[fcron]].
This script backs up contacts (database and also exports them with osso-addressbook-backup for safety), conversations, calendar, bookmarks, repository and packages list to external memory card's directory Backup which then contains subdirectories named with date and time when the backup was performed. The path is also definable. For example: "Memory_card/Backup/2010-03-03_00-00". It also displays notification during backup, because it was made to be used with [[fcron]].
 +
====Script====
====Script====
-
<source lang="bash">
+
#!/bin/sh
-
#!/bin/sh
+
-
 
+
path=/media/mmc1/Backup/`date +"%F_%H-%M`
-
path=/media/mmc1/Backup/`date +"%F_%H-%M"`
+
-
 
+
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Making backup..."
-
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Making backup..."
+
-
 
+
mkdir -p "$path"/home/user/.bookmarks
-
mkdir -p "$path"/home/user/.bookmarks
+
mkdir    "$path"/home/user/.calendar
-
mkdir    "$path"/home/user/.calendar
+
mkdir    "$path"/home/user/.osso-abook
-
mkdir    "$path"/home/user/.osso-abook
+
mkdir    "$path"/home/user/.osso-abook-backup
-
mkdir    "$path"/home/user/.osso-abook-backup
+
mkdir    "$path"/home/user/MyDocs
-
mkdir    "$path"/home/user/MyDocs
+
mkdir -p "$path"/var/lib/hildon-application-manager
-
mkdir -p "$path"/var/lib/hildon-application-manager
+
-
 
+
cp    /home/user/.bookmarks/MyBookmarks.xml*                "$path"/home/user/.bookmarks
-
cp    /home/user/.bookmarks/MyBookmarks.xml*                "$path"/home/user/.bookmarks
+
cp    /home/user/.calendar/calendardb                      "$path"/home/user/.calendar
-
cp    /home/user/.calendar/calendardb                      "$path"/home/user/.calendar
+
cp -r /home/user/.osso-abook/db                            "$path"/home/user/.osso-abook
-
cp -r /home/user/.osso-abook/db                            "$path"/home/user/.osso-abook
+
cp -r /home/user/.osso-abook-backup/db                      "$path"/home/user/.osso-abook-backup
-
cp -r /home/user/.osso-abook-backup/db                      "$path"/home/user/.osso-abook-backup
+
cp -r /home/user/.rtcom-eventlogger                        "$path"/home/user
-
cp -r /home/user/.rtcom-eventlogger                        "$path"/home/user
+
cp -r /home/user/MyDocs/.documents                          "$path"/home/user/MyDocs
-
cp -r /home/user/MyDocs/.documents                          "$path"/home/user/MyDocs
+
cp    /var/lib/hildon-application-manager/catalogues*      "$path"/var/lib/hildon-application-manager
-
cp    /var/lib/hildon-application-manager/catalogues*      "$path"/var/lib/hildon-application-manager
+
cp    /var/lib/hildon-application-manager/packages.backup  "$path"/var/lib/hildon-application-manager
-
cp    /var/lib/hildon-application-manager/packages.backup  "$path"/var/lib/hildon-application-manager
+
-
 
+
echo "osso-addressbook-backup -e "$path"/osso-addressbook-backup" | su - user
-
echo "osso-addressbook-backup -e "$path"/osso-addressbook-backup" | su - user
+
 +
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Backup created"
-
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Backup created"
 
-
</source>
 
===osso-backup (what is backed up by it)===
===osso-backup (what is backed up by it)===
[[Documentation/Maemo 5 Developer Guide/Generic Platform Components/Using Backup Application|osso-backup]] is the default Backup application on the phone. You can use it for "manual" backup, because it produces standard .zip compressed files which can be opened on any system. The list of files that osso-backup backs up can be obtained by making a backup with it and opening these zip files (the list is too long for this wiki page).
[[Documentation/Maemo 5 Developer Guide/Generic Platform Components/Using Backup Application|osso-backup]] is the default Backup application on the phone. You can use it for "manual" backup, because it produces standard .zip compressed files which can be opened on any system. The list of files that osso-backup backs up can be obtained by making a backup with it and opening these zip files (the list is too long for this wiki page).
 +
===osso-addressbook-backup===
===osso-addressbook-backup===
Line 72: Line 54:
  echo "osso-addressbook-backup -e /path/file" | su - user
  echo "osso-addressbook-backup -e /path/file" | su - user
 +
===rsync===
===rsync===
rsync is standard Linux/Unix file and directory synchronization tool. It is in extras repository. An example backup script is shown here:
rsync is standard Linux/Unix file and directory synchronization tool. It is in extras repository. An example backup script is shown here:
 +
====Script====
====Script====
-
<source lang="bash">
+
#!/bin/sh
-
#!/bin/sh
+
 +
if [ `whoami` != "root" ]; then
 +
  echo "Please run as root to preserve file ownership."
 +
  exit 1
 +
fi
 +
 +
dpkg -l > /root/dpkg.txt
 +
 +
gconftool-2 -R /system/osso/connectivity/IAP > /root/iap.txt
 +
 +
rsync  -avz                    \
 +
        --numeric-ids          \
 +
        --exclude=/dev          \
 +
        --exclude=/media        \
 +
        --exclude=/mnt/initfs  \
 +
        --exclude=/proc        \
 +
        --exclude=/sys          \
 +
        /                      \
 +
        mypc.example.com:/home/archive/mytablet/
-
if [ `whoami` != "root" ]; then
+
Change "mypc.example.com" to the IP/hostname of your computer and the target directory to whatever suits you. Don't forget to make the script executable and it must be run as root of course.
-
echo "Please run as root to preserve file ownership."
+
-
exit 1
+
-
fi
+
-
dpkg -l > /root/dpkg.txt
+
The "dpkg -l" command makes a list of installed packages and gconftool-2 lists all internet access points (Wi-Fi and GPRS), so you can copypaste details back later.
-
dpkg --get-selections  > /root/dpkg-selections.txt
+
-
 
+
-
gconftool-2 -R /system/osso/connectivity/IAP > /root/iap.txt
+
-
 
+
-
rsync  -avz                    \
+
-
        --numeric-ids          \
+
-
        --exclude=/dev          \
+
-
        --exclude=/media        \
+
-
        --exclude=/mnt/initfs  \
+
-
        --exclude=/proc        \
+
-
        --exclude=/sys          \
+
-
        /                      \
+
-
        mypc.example.com:/home/archive/mytablet/
+
-
</source>
+
-
 
+
-
Change <code>mypc.example.com</code> to the IP/hostname of your computer and the target directory to whatever suits you. Don't forget to make the script executable and it must be run as root of course.
+
-
 
+
-
The <code>dpkg -l</code> command makes a list of installed packages, <code>dpkg --get-selections</code> output can be passed directly to <code>--set-selections</code> to install/uninstall packages as they were on the device.
+
-
 
+
-
Finally, gconftool-2 lists all internet access points (Wi-Fi and GPRS), so you can copypaste details back later.
+
==Automatic/periodic/scheduled backups==
==Automatic/periodic/scheduled backups==
Maemo currently does not provide an option to schedule backups nor does the osso-backup have interface to be run from command line and thus be scheduled. So the backup scripts needs to be written manually. You get them here (or you write your own), but to schedule them periodically you need fcron or similar. The scheduling part is covered in detail on [[fcron]] wiki page. With combining these two wiki pages you can have fully working automatic backups.
Maemo currently does not provide an option to schedule backups nor does the osso-backup have interface to be run from command line and thus be scheduled. So the backup scripts needs to be written manually. You get them here (or you write your own), but to schedule them periodically you need fcron or similar. The scheduling part is covered in detail on [[fcron]] wiki page. With combining these two wiki pages you can have fully working automatic backups.
 +
==Wipe methods==
==Wipe methods==
Wiping the device clean is achieved with reflashing. This is covered in the [[updating the firmware]] article and similar.
Wiping the device clean is achieved with reflashing. This is covered in the [[updating the firmware]] article and similar.
 +
==Restore methods==
==Restore methods==
Line 122: Line 103:
Restoring entries below were made by the author of the rsync backup script, but they are very similar to any restoring process. Also don't forget that the applications which use the files you are restoring need to be closed/stopped/killed.
Restoring entries below were made by the author of the rsync backup script, but they are very similar to any restoring process. Also don't forget that the applications which use the files you are restoring need to be closed/stopped/killed.
 +
===Contacts===
===Contacts===
-
You need to create a dummy entry before restoring contacts. Run the contacts application first and create a contact, anything will do. Then exit the contacts application and restore the files in <code>/home/user/.osso-abook/db</code> and <code>/home/user/.osso-abook-backup/db</code>. The contacts will be restored after rebooting the device.
+
You need to create a dummy entry before restoring contacts. Run the contacts application first and create a contact, anything will do. Then exit the contacts application and restore the files in '''/home/user/.osso-abook/db''' and '''/home/user/.osso-abook-backup/db'''.
 +
 
===Bookmarks===
===Bookmarks===
-
Close the browser first, then simply copy the files from your archive to the phone to <code>/home/user/.bookmarks</code>. The bookmarks should appear immediately.
+
Close the browser first, then simply copy the files from your archive to the phone to '''/home/user/.bookmarks'''. The bookmarks should appear immediately.
 +
 
 +
The bookmarks are saved in '''MyBookmarks.xml''' file, so this is the one that you really need, other files are thumbnails and the like.
-
The bookmarks are saved in <code>MyBookmarks.xml</code> file, so this is the one that you really need, other files are thumbnails and the like.
 
===Calendar===
===Calendar===
-
The calendar entries are in the file <code>/home/user/.calendar/calendardb</code>. A restart is required.
+
The calendar entries are in the file '''/home/user/.calendar/calendardb'''.
-
===Conversations===
 
-
The sqlite database containing SMS data is located at <code>/home/user/.rtcom-eventlogger/*</code>. Make sure rtcom-messaging-ui is closed. Conversations can be accessed as soon as the folder is restored.
 
===Repository and packages list===
===Repository and packages list===
-
These are located in <code>/var/lib/hildon-application-manager</code>, files <code>catalogues.backup</code>, <code>catalogues2.backup</code> and <code>packages.backup</code>. These can't be just copied back, because osso-backup uses them in its own way (asks which applications should be reinstalled), but you can use them as list of what you had installed.
+
These are located in '''/var/lib/hildon-application-manager''', files '''catalogues.backup''', '''catalogues2.backup''' and '''packages.backup'''. These can't be just copied back, because osso-backup uses them in its own way (asks which applications should be reinstalled), but you can use them as list of what you had installed.
 +
 
===IM/Chat/SIP accounts===
===IM/Chat/SIP accounts===
-
These accounts are stored in <code>/var/lib/gconf/apps/telepathy/mc/accounts</code>. It's probably a good idea to set your presence to "off" before trying to restore.
+
These accounts are stored in /var/lib/gconf/apps/telepathy/mc/accounts. It's probably a good idea to set your presence to "off" before trying to restore.
 +
 
===E-mail (Modest)===
===E-mail (Modest)===
-
Restoring <code>/home/users/.modest</code> and <code>/var/lib/gconf/apps/modest</code> doesn't work properly. I had to create the email server settings, but at least the old email did come back. Actually, I think it might have worked, but the mailbox didn't appear. I discovered that the old mailboxes were there when I looked for them in Menu->View and chose one of the mailboxes.
+
Restoring /home/users/.modest and /var/lib/gconf/apps/modest doesn't work properly. I had to create the email server settings, but at least the old email did come back. Actually, I think it might have worked, but the mailbox didn't appear. I discovered that the old mailboxes were there when I looked for them in Menu->View and chose one of the mailboxes.
 +
 
 +
The rabbit hole goes deeper. I didn't notice there was a problem after restoring, as I use a special email address for my tablet and it didn't get any email for a while, so I was quite happy accessing my recovered emails. When a new email arrived, it killed modest, and I was unable to restart it - the UI would show up briefly before modest died. The only way I could make modest run without crashing was to rename /home/user/.modest to /home/user/.modest.xxx.
-
The rabbit hole goes deeper. I didn't notice there was a problem after restoring, as I use a special email address for my tablet and it didn't get any email for a while, so I was quite happy accessing my recovered emails. When a new email arrived, it killed modest, and I was unable to restart it - the UI would show up briefly before modest died. The only way I could make modest run without crashing was to rename <code>/home/user/.modest</code> to <code>/home/user/.modest.xxx</code>.
 
===RSS Feeds===
===RSS Feeds===
-
Close RSS application and copy files to <code>/home/user/.osso_rss_feed_reader</code>.
+
Close RSS application and copy files to /home/user/.osso_rss_feed_reader.
 +
 
===Wi-Fi and GPRS access points===
===Wi-Fi and GPRS access points===
You'll have to manually re-enter them, but you can copypaste details from the file created with rsync backup script (iap.txt).
You'll have to manually re-enter them, but you can copypaste details from the file created with rsync backup script (iap.txt).
 +
===Other===
===Other===
Line 166: Line 153:
====gPodder====
====gPodder====
-
Close gPodder and copy its config directory to <code>/home/user/.config/gpodder</code>.
+
Close gPodder and copy its config directory to /home/user/.config/gpodder.
 +
 
====OpenVPN Applet====
====OpenVPN Applet====
Line 173: Line 161:
[[Category:Power users]]
[[Category:Power users]]
-
[[Category:N900]]
 

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)