Take this as a note rather than a guide, by the way don’t forget to execute these commands as root.
Backup:
cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found \
--exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/dev /
Restore:
tar xvpfz backup.tgz -C / mkdir proc lost+found mnt sys dev
[ source Ubuntu Forums ]