Really, What a lovely OS is Debian.
I must admire its technical design. Recently I had to wipe out my hard drive for some reasons. I had put a lot of effort into selection of packages and configuration as per my taste.
And guess what, re-installation is a cool breeze in Debian. Every setting and every package (from multiple sources) were back. I use a mixture of Testing + Unstable + Experimental + (Some other apt sources) on my laptop.
Backup your /home and /etc directory. I’ll leave /etc/ upto you but /home/ is important. Right ? Also backup any non-standard path where you might have saved important data
dpkg –get-selections > package-selection.txt. This will make a database of the packages installed on your system. This is important, don’t forget to copy it to another reliable media
Also backup your /etc/apt/ folder. I back it up because that’s where the core repository settings are.
Wipe out your hard drive now.
Do a new installation of Debian. Try to make it a bare minimum installation.
Restore your /home back.
Resotre your /etc/apt/sources.list , /etc/apt/preferences and other important ones that you might have.
Obviously you’ll do an
**apt-get update**
Now the game to restore everything back as it was in the beginning.
dpkg --set-selections <package-selection.txt
That’ll will do the rest of the job for you bringing back every package you had installed from different sources.
Just to note is that if you had custom built packages (list Sun Java or Pine or Qmail et cetera), you’ll have to re-build and re-install them manually. If you also don’t want to configure your system configurations you might want to re-store your /etc/apt folder.
Hope this has helped you. Cheers!