How to back up a Debian based Linux

The one major advantage of Linux is that as root you have read/write access to every file on your system; this makes backing up possible with tar.

You should exclude any mount points which you don’t want to be backed up; I would recommend backing them up individually. You should also not back up /sys and /prc as these are created during boot up.

Tar options explained;

-c: create new archive

-v: verbose

-p:absolute names to files. It does not strip of leading /

-z: applies gzip compression

-j:applies bzip2 compression. Slower but smaller

-f: creates a single file

–exclude: excludes directories.

cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/media--exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/mnt --exclude=/home/Data --exclude=/dev /


For greater compression use BZip
cd /
tar cvpjf backup.tar.bz2 --exclude=/proc ..../


To restore copy the extract into the root directory (/)

For gzip
cd /
tar xvpfz backup.tgz -C /<code>

For bzip

cd /
tar xvpfz backup.tgz -C /


Dont forget to make the dirs that you –exclude and make tmp work excutable

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s