Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Friday, 27 September 2013

Desktop Backup Using Rsync

Backing Up Over SSH Using Rsync

This article will look at our workstation backup solution which uses rsync for keeping our home directories in sync with a directory on a NAS over SSH.

Its not a smart backup or anything just uses rsync to synchronise our home directories and any working directories, adding any new files and removing any that have been deleted.

Our workstations are the source and the NAS is the destination so if anything goes wrong with our systems we can just rsync them backup and use our installed package list to restore our workstation with minimal interaction.


Image of two squares one gree the other purple with the word rsync
rsync


Doing the Backup

For the command to do the work its just a simple one liner to instruct rsync what to backup and to were and passing any command arguments to control options.
chris@chic:~# rsync -avz --delete /home/chris chris@192.168.0.123:/home/Private/Backup

The above command uses the -a switch for making an archive the -v makes the program more verbose -z compresses and finally the --delete removes any files from the destination which were deleted from the source.

Using this will keep the two directories in complete sync but also will not keep any files which have been deleted from the source which is what we require.

You can get more information about rsync and its command arguments by reading the man page which is here or just run man rsync from a shell prompt.

Conclusion

As you can see from this article keeping two directories in sync using rsync is a very simple task and can provide a "casual" backup solution for desktops or workstations.

On a side note our new Reddit and Google+ social media pages are doing well and we have been seeing some referrals from these to our website so we hope to build upon this and improve our offerings and community.

Wednesday, 18 September 2013

Backup Package List on Debian

Using dpkg

One thing we do on both our servers and workstation is to backup the installed package list in case we need to rebuild the system we can make sure it has exactly the same programs available.

Using dpkg which is the Debian package manager we can dump a list to a standard text file ready for backup, for us we use Google Drive for our backup remote storage so the list will also be backed up there.


dpkg Package Manager

The Backup

We have added package backup to our server backup system and to do the actual backup is as simple as running a single command. This will dump the package list to a text file named package_list.txt
root@chic:~# dpkg --get-selections > package_list.txt

The Restore

To restore the installed packages on a fresh machine is just as simple you just use the set-selections switch when running dpkg. After running dpkg we update our package list and upgrade the system.
root@chic:~# dpkg --set-selections < package_list.txt && apt-get update && apt-get -u dselect-upgrade


Conclusion

This article show how simple a task it is to backup your installed programs so if you need to start fresh you can make sure the programs you had installed are installed again and hassle free to.

In a future article we hope to cover our system restore scripts which can be used for setting up a clean Debian minimal network install into a production ready server.