I have several systems that I use throughout my house but, they all follow the same basic strategy:
- daily backups of each computer to a storage device in my home network
- daily backups of my local storage device to a remove location
I use two different tools for the job:
In the following paragraphs, I will provide more details on how I currently backup my main laptop.
My main computer uses Déjà Dup to backup my home directory and saves to a shared network drive via SSH. This gives me the flexibility of backing up to my drive ( at home ) from anywhere where I have network connectivity.
Let's go through this in a bit more detail:
Let's go through this in a bit more detail:
Backup DriveFirst things first. Let's get a drive in which to backup our data. I have a 2TB USB drive attached to one of my servers that I make available via SSH to my local network.
Here are the steps that I took to get the drive connected, partitioned, formatted, mounted and available:
- Connect drive to any available USB port on your server.
- Make sure to turn the power on your USB drive :)
- On my server, the USB drive showed up as /dev/sdd1 as there is an existing partition there
- Let's partition the drive with cfdisk ( Please read the manual for cfdisk BEFORE doing anything with cfdisk. )
- sudo cfdisk /dev/sdd ( notice that I am working with the entire drive here and not just the partition )
- delete any partitions in the drive and create one ext4 partition that uses the entire drive.
- Use the menu items at the bottom to delete the existing partitions
- When you create a new partition, cfdisk will default to create a partition using all available space, keep those defaults
- The linux partition type is 83 ( cfdisk should default to this but, just in case you need it )
- Make sure to Write the changes to disk
At this point, you should have a new partition on your backup drive:
- In my case, my USB drive was recognized as /dev/sdd.
- I created one partition on that drive.
- The above tells me that my partition should be /dev/sdd1
Let's format our partition to get things going:
- sudo mkfs.ext4 /dev/sdd1
Alas! We have a partition ready for use. Let's mount it ( mine is mounted on /media/Backup1 ):
- sudo mkdir -p /media/Backup1
- sudo mount /dev/sdd1 /media/Backup1
If you've made it this far, you should now have a new "mount point" where you can access your backup drive. Let's verify that by checking what partitions have been mounted:
- df -h
- The backup drive should be listed there as one of the partitions. Here is what the relevant part of mine looks like:
- /dev/sdd1 1.8T 466G 1.3T 27% /media/Backup1
The last part on getting the Backup drive ready is to ensure that it can be accessed from your network. In my case, i have a username on all of the boxes that can access the backup server via SSH key. I also ensure that /media/Backup1 is owned by this username:
- sudo chown -R negronjl:negronjl /media/Backup1
- ( Feel free to use whatever username you want for the above )
- I use Ubuntu on my systems so, I already have Déjà Dup installed and only need to configure a few things to get going
- Open the dash ( Super key ) and type backup. Déjà Dup will be in that list under the name of Backup.
- Click on Backup.
- My Déjà Dup configuration looks something like:
- Storage tab:
- Backup location: SSH
- Server: <my backup server>
- Port: 22
- Folder: /media/Backup1/DejaDup
- Username: <negronjl> Use whatever username you used in the previous step
- The Folders tab:
- Folders to back up: <home directory>
- Folders to ignore: Trash, Downloads
- In the above setting, feel free to add any folder already being backed up or that needs to be ignored.
- How often to back up: Daily
- Keep backups: At least 28 days ( This can be changed )
- Close the window ... everything should be up and running now.
I use backupninja to backup my entire machine in case of catastrophic failure. Here is how to set up and configure backupninja:
- sudo apt-get install backupninja
- when = everyday at 01
options = --s3-use-new-style
nicelevel = 19
testconnect = no
tmpdir = /home/backupninja/tmp
sign = yes
encryptkey = <your GPG key>
password = <your GPG key password>
include = /etc
include = /home
include = /opt
include = /usr/local
include = /root
exclude = /home/*/.gvfs
exclude = /home/*/.Private
exclude = /home/.ecryptfs
incremental = yes
increments = 30
keep = 60
desturl = rsync://<backup_username>@<backup_server>//media/Backup1/Backups/backupninja/negronjl-laptop/negronjl-laptop
awsaccesskeyid = <YOUR_AWS_ACCESS_KEY_ID>
awssecretaccesskey = <YOUR_AWS_SECRET_KEY>
Adapt the above file to suit your needs ( usernames, passwords and such ) and save it to /etc/backup.d as something like <number>-<name>.dup Where <number> determines the order of execution of the files in the /etc/backup.d/ directory and <name> is an identifying name for the file ( something that tells you what the file is/does ). As an example, my backupninja configuration file is named:
I'd love to hear your backup strategies ...