- Combination of the words "Andri" and "Droid"
- Sysadmin, developer and a student
- Born in Reykjavík, Iceland
- Studying in Aalborg, Denmark
- Not the Google project
Automatic USB backup with Ubuntu
Update: This article is originally from andri.dk and is provided as is. Some of the information is outdated, but hopefully still helpful to some.
Everyone has important files like personal photographs, bank statements, a life's accumulation of porn and so and and so forth that would be hard or impossible to recover if that damn hard drive would fail.
I've always been well aware of the dangers of not taking backups but yet still lazy enough to ignore it.
Backup for the lazy includes the following steps:
- Put USB stick in computer
- Wait for computer to BEEP or USB stick to stop flashing
- Unplug USB stick
- Rinse and repeat!
I wrote a package that does the following:
- Detects USB drives connected to the computer and runs the backup script
- Only runs backup on partitions that match the configured volume_id
- Mounts the volume
- Runs rsync and takes an incremental copy of the files that have changed since a last backup.
- Unmounts the volume
- Gives a good or a bad beep through the PC speaker
Step by Step
- Insert your USB stick/disk
- Make sure it has a usable partition. I use FAT32 so my Mac can also read it. (hint: System > Administration > Partition Editor)
- Download the two files and put them in the appropriate places
- /etc/udev/rules.d/55-usb-backup.rules (udev rule)
- /usr/local/bin/usb-backup (shell script)
- Find the volume id of your partition and replace mine in the 'usb-backup' file
root@ubahmaskine: vol_id -u /dev/sdd1
4507-FB5A
- Set SRC_DIR to the directory you want backed up within 'usb-backup'
- Make sure the 'usb-backup' file has the execute permission for root:
chmod 700 /usr/local/bin/usb-backup - Unplug USB stick
- Plug in USB stick
- After it beeps or stops flashing try mounting it f.e.
mount /dev/sdd1 /mnt/sdd1 - Check if all your files made it accross
- Unmount the volume again f.e.
umount /dev/sdd1 - Unplug and plug it in again once a week or so.
- For audio beep to work you need the 'beep' package (apt-get install beep)
Notes and credit
- Thanks to Anders for his original idea and implementation of this.
- The script does not check if the volume has enough space to do the backup. If it doesn't, it will fail!
- If umounting seems slow, it's due to delayed write to the USB drive.
- Should work on other Linux distributions as long as udev is present.
- This is provided 'as is' and offers no guarantee. Use at your own risk!
- Global Tags:
Comments
Hey, I would really love to
Hey, I would really love to use this, but the files to download were apparently never transfered over from andri.dk. Any way these files could be reposted?
Sorry mate, I've uploaded the
Sorry mate, I've uploaded the files now.
Post new comment