Posted under Linux
Permalink
Tags Backup, iMedia, Linux
This article here discusses how to perform Linux backups and restores using tar ( I have also saved a pdf of the post in the Linux section of the repository).
I wanted to at least backup my system so that I had all the custom configuration and shell scripts backed up.
I was not looking to do a full restore – if I lost the system I would reinstall from CD and then probably pull from the backup piecemeal manually as required.
As an Imedia system is so small (mine is only 2GB), I backed up to a FAT32 flash drive and then archived the backup elsewhere. Imedia does a good job of handling USB drives, but will need FAT32 rather than NTFS.
tar appears to do a pretty good job of backups – symbolic links are handled correctly by default (it backs up the links rather than following to the files), and permissions etc. are backed up as per the above article.
The following example shows my backup script, generated with the help of the above article:-
#!/bin/bash if [ -z $1 ]; then read -p "Enter Backup Name:" name; else name=$1; fi if [ -z $2 ]; then read -p "Enter output directory:" dir; else dir=$2; fi file="${name}_`date +%Y-%m-%d_%H-%M-%S`" if [[ $dir != */ ]]; then dir=$dir/; fi file=$dir$file echo Backup: $name started at: `date +"%d-%m-%Y %H:%M:%S"` > $file.log echo Output File: $file.tar.gz >> $file.log echo >> $file.log tar -cvpzf $file.tar.gz --exclude=$file.* --exclude=/proc --exclude=/lost+found --exclude=/sys \ --exclude=/mnt --exclude=/media --exclude=/dev --exclude=/var --exclude=/tmp / >> $file.log 2>&1 echo >> $file.log echo Backup: $name completed at: `date +"%d-%m-%Y %H:%M:%S"` >> $file.log