Backup and restore with dpkg

From wiki.breedveld.net
Jump to: navigation, search

Ik you want to make a clean install with e.g. Ubuntu: first backup your home and packages list: (/media/disk-1 is an example for your backup medium)

dpkg --get-selections > /media/disk-1/dpkg_list.txt
tar -czvf /media/disk-1/home_backup.tgz /home/*

make a fresh install with your Ubuntu version, and after that restore your stuff: first log in as root!

dpkg --set-selections < /media/disk-1/dpkg_list.txt
apt-get update
dselect update
apt-get dselect-upgrade
cd /
tar -xzvf /media/disk-1/home_backup.tgz