Setting up Amanda to backup a linux box to Amazon S3

Here is my experience with compiling and configuring amanda to backup to the cloud (S3).

First compiling and installing amanda

  1. Create a user ‘amanda’ in group ‘backup’. Login as this user
  2. Download amanda-3.3.2.tar.gz, unzip
  3. As user amanda, run ‘./configure –enable-s3-device’ and ‘make’
  4. As user root, run ‘make install’
  5. Now this next instruction is basically a hack to workaround some packaging bugs in amanda:
    • chgrp backup /usr/local/sbin/am*

Next, creating a backup configuration called ‘MyConfig’ for backing up /etc to a virtual tape in the directory /amanda

  1. As root, create a directory /amanda, and chown it to amanda:backup
  2. Run the following commands as user amanda:
    • mkdir -p /amanda/vtapes/slot{1,2,3,4}
    • mkdir -p /amanda/holding
    • mkdir -p /amanda/state/{curinfo,log,index}
  3. As root, create a directory ‘/usr/local/etc/amanda/MyConfig’, and chown it to amanda:backup.
  4. As user amanda, create a file /usr/local/etc/amanda/MyConfig/amanda.conf with the following contents:

 

org "MyConfig"
infofile "/amanda/state/curinfo"
logdir "/amanda/state/log"
indexdir "/amanda/state/index"
dumpuser "amanda"

tpchanger "chg-disk:/amanda/vtapes"
labelstr "MyData[0-9][0-9]"
autolabel "MyData%%" EMPTY VOLUME_ERROR
tapecycle 4
dumpcycle 3 days
amrecover_changer "changer"

tapetype "TEST-TAPE"
define tapetype TEST-TAPE {
  length 100 mbytes
  filemark 4 kbytes
}

define dumptype simple-gnutar-local {
    auth "local"
    compress none
    program "GNUTAR"
}

holdingdisk hd1 {
    directory "/amanda/holding"
    use 50 mbytes
    chunksize 1 mbyte
}
  • Create a file /usr/local/etc/amanda/MyConfig/disklist with the following contents:
localhost /etc simple-gnutar-local
  • As root make a directory /usr/local/var/amanda/gnutar-lists, and change ownership of this directory to amanda:backup
  • Next, as user amanda, run the program ‘amcheck MyConfig’. It should finish its report with ‘Client check: 1 host checked in 2.064 seconds.  0 problems found.’
  • Next, run ‘amdump MyConfig’. The program should exit with return value 0
  • Finally, run ‘amreport MyConfig’ to get the status of you backup effort!

That’s it for testing a local backup to the virtual tape /amanda. Now, on to trying this with S3 as the tape backend.

  • Create a new config directory /usr/local/etc/amanda/MyS3Config/amanda.conf with the following contents:
org "MyS3Config"
infofile "/amanda/state/curinfo"
logdir "/amanda/state/log"
indexdir "/amanda/state/index"
dumpuser "amanda"

# amazonaws S3
device_property "S3_ACCESS_KEY" "YOUR_AMAZON_KEY_ID_HERE"
device_property "S3_SECRET_KEY" "YOUR_AMAZON_SECRET_KEY_HERE"
device_property "S3_SSL" "YES"
tpchanger "chg-multi:s3:YOUR_NAME-backups/MyS3Config1/slot-{01,02,03,04,05,06,07,08,09,10}"
changerfile  "s3-statefile"

tapetype S3
define tapetype S3 {
    comment "S3 Bucket"
    length 10240 gigabytes # Bucket size 10TB
}

define dumptype simple-gnutar-local {
    auth "local"
    compress none
    program "GNUTAR"
}

holdingdisk hd1 {
    directory "/amanda/holding"
    use 50 mbytes
    chunksize 1 mbyte
}
  • Enter your S3 Account Key ID, Secret Key and change YOUR_NAME to your name in the above config example
  • Now run the command
    • amlabel MyS3Config MyS3Config-1 slot 1
  •  If this works fine, then run the following command to create 9 more slots
    • for i in 2 3 4 5 6 7 8 9 10; do amlabel MyS3Config MyS3Config-$i slot $i; done;
  • Finally run the following to verify:
    • amdevcheck MyS3Config s3:jaganes-backups/MyS3Config1/slot-10
  • Now you are ready to run a backup. Define one for the /etc directory on your machine by adding the file /usr/local/etc/amanda/MyS3Config/disklist with the following line:
    • localhost /etc simple-gnutar-local
  • Try running a backup using the command:
    • amdump MyS3Config
  • Check the return value of the command, and if that is 0, check the contents of the backup bucket on S3 using S3fox or some such tool.

That’s all folks. You have created a backup of your linux machine’s /etc directory on Amazon’s S3 cloud storage service.

It would be interesting to try this with Amazon’s glacier service, which is much cheaper than S3

avatar

About Jagane Sundar

2 Responses to “Setting up Amanda to backup a linux box to Amazon S3”


  • Hi,

    I had followed the above steps and able to backup.
    Then how to recover that backups can you please explain me.

  • Thanks much for the steps. The HowTo on the amanda site didn’t work at all for me and this did.

Leave a Reply