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 /
su
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 /
<code>


 

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


 

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

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

For bzip

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

 

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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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