Posts Tagged sysadmin

Backup using rdiff-backup

I’ve been using rdiff-backup to automate my linux backups for a while now. I just recently made some improvements to my cronjob which performs a nightly backup and thought I’d share it here.

Rdiff-backup is a great application which wraps around rdiff to backup entire directories from one place to another. It’s very efficient too. Rdiff only transfers the changes to files, which means it’s great for performing offsite backups.

Only problem is that it’s still not easy enough to use – so I wrote a script to *really* automate things.

Here’s how to get it working:

  1. Install rdiff-backup on local and remote computers (apt-get install rdiff-backup for debian/ubuntu, build for windows, build for osx or build from source for anything else).
  2. Copy this script to /etc/cron.d/backup (you’ll probably have to rename that downloaded file)
  3. Create configuration directories /etc/backup/ and /etc/backup/hosts/
  4. Create the main configuration file /etc/backup/backup.conf with your settings using this template
    [sourcecode language=’sh’]
    # This is the config for a script which uses rdiff-backup to perform a nightly
    # backup of various
    # servers to this computer. It should be called via cron and should be
    # configured to send stderr to a sysadmin.
    #

    #==============================Config section==================================

    # local directory to store backups
    BACKUP_DIR=/usr/data/backups

    # location of remote host specific back up details
    HOST_CONFIGS_DIR=/etc/backup/hosts

    # Number of days to keep backups for. If unset backups will be kept forever
    KEEP_BACKUP_DAYS=62

    # parameters to pass to rdiff-backup
    RDIFF_BACKUP_PARAMETERS=”–force”

    # set to 0 for debugging information to be suppressed
    DEBUG=1

    #================================End Config Section============================
    [/sourcecode]

  5. Create a configuration file for each host you want to backup. This must be in the format of “backup.hostname” – i.e. backup.hammer.cs.curtin.edu.au or backup beans.ath.cx. You can refer to the localhost through its name too (i.e. backup.mycomp). These must be placed in /etc/backup/hosts/
    [sourcecode language=’sh’]
    # Config options for backing up remote computers
    # filename must be in the format of
    # backup.hostname.domain

    # The directory to start the backup at.
    START_DIR=”/”

    # Directories to backup. use a space to seperate.
    # INCLUDE_DIRS will have preference.
    # ie. if we include /usr/data/wilson but exclude /usr/data everything under
    # /usr/data/wilson will be backed up, but /usr/data/tim won’t be.
    INCLUDE_DIRS=”/usr/data/wilson/data”

    EXCLUDE_DIRS=”/usr/data /proc /cdrom /tmp /mnt /sys /home/squid /home/www/gallery2″
    [/sourcecode]

  6. Create an SSH key with no passphrase which will allow you to logon to the remote computer without typing a password (we will be automating this with cron remember). This link gives some details.
  7. Create a cronjob to run the script.
    30 4 * * *     root    /etc/cron.d/backups

Your remote computers should now be automatically backed up every night!

I haven’t actually tried this with windows or Mac OSX computers, but I believe it can be made to work.

, , , ,

2 Comments

Adding drives to a Dell MD1000 storage array

We recently bought a Dell MD1000 storage array (to go with our Dell PowerEdge 2900) with 5TB of space. We’re running Ubuntu (I prefer plain old Debian…. but oh well…).

They say these things are expandable up to 45TB (all on a single virtual disk)… I wanted to make sure it’s really possible! Here’s how I did it:

I ended up using the Dell Open Manage command line interface as I couldn’t get the OpenManage web interface working with Ubuntu. I presume there’s something similar with the Windows install of OpenManager.

See this post to install Dell OSMA and open the manual for the omreport and omconfig commands.

  1. display the current controllers:

    omreport storage controller
  2. display the current physical disk status:

    omreport storage pdisk controller=1
  3. display the current virtual disk status:

    omreport storage vdisk
  4. insert the new drive (and take note of the bay number)
  5. reconfigure the virtual disk with the new drive

    omconfig storage vdisk action=reconfigure controller=1 vdisk=0 raid=r5 adisk=0:0:9,0:0:10,0:0:11,0:0:12,0:0:13,0:0:14

    where 0:0:9 was the new drive and 0:0:10,0:0:11,0:0:12,0:0:13,0:0:14 were the existing ones.
  6. check if it’s finished reconstructing with

    omreport storage vdisk
  7. wait….. wait….. go home…. come back….
  8. resize the partition and file system in your operating system.For me, this involved using LVM tools to resize the partition, then resize2fs to resize the ext3 filesystem

, , , ,

1 Comment