Backup:
- cd /
- sudo tar -cvpzf /media/xxx/backup.tar.gz --exclude=/cdrom --exclude=/home --exclude=/lost+found --exclude=/media --exclude=/mnt --exclude=/proc --exclude=/tmp --exclude=/sys /
Restore:
- cd /
- sudo tar -zxvfp /media/xxx/backup.tar.gz -C /
Suppose you mount the '/home' directory to a big part of the hard-drive, and don't format that area when re-install ubuntu(just mount '/home' there again)