Disclaimer - I haven't done this before... but grab the original CD that you used to install from, and compare the packages.txt with the results of ' dpkg -l '.

' dpkg -l >curpkgs.txt '
' diff packages.txt curpkgs.txt '

--But seriously, config files don't take up a whole lot of space - especially with reiserfs and the default mount option (tail.)

--The other options I have both involve a lot of work, and should really only be done if you're really worried about these config files being on there from a security perspective, or (like me) you just want to feel good about how clean your system is.

0. BACKUP /etc. ' tar czvf ~/etc-backup.tgz /etc '

1. Fire up ' mc ' and go thru /etc file by file, deleting things that you know aren't installed anymore. However, this requires a thorough knowledge of Linux in general.

=====

Option 2:

o Backup critical files - CHANGE SCRIPT AS NECESSARY FOR YOUR SYSTEM ; I have an entry in fstab for /mnt/zippy as a 100-MB Zip IDE internal drive. - #BEGIN bkpcrit
Code:
#!/bin/sh
# Backup critical files (hopefully)

dest='/mnt/zippy'
mount $dest

##[ -e "$dest/NOTHERE" ] && echo "$dest NOT MOUNTED" && exit 99

# "If" checking for NOTHERE file...

dest=$dest'/linux-p233-knoppix32'
echo $dest = PK
read

mkdir $dest

# Copy this bkp script to zippy
cp $0 $dest
cp ~/localinfo.dat $dest

dpkg --get-selections > ~/dpkg-selections.txt
## To get your currently installed packages. Once you re-install then:
# dpkg --set-selections < dpkg-selections.txt
## To restore the saved selections to the package system.
#
## Then
# dselect update
## To update the database and
# apt-get dselect-upgrade
## To perform an upgrade using the the restored packages list.

time {
tar cpvzf $dest/bkp-ETC-debian.tar.gz /etc
tar cpvzf $dest/bkp-DEV-debian.tar.gz /dev
tar cpvzf $dest/bkp-rootbin-debian.tar.gz /root
tar cpvzf $dest/bkp-davesrc-debian.tar.gz /home/dave/src
tar cpvzf $dest/bkp-davebin-debian.tar.gz /home/dave/bin
tar cpvzf $dest/bkp-usr-local-debian.tar.gz /usr/local
tar cpvzf $dest/bkp-var-dpkg-status.tar.gz /var/lib/dpkg
tar cpvzf $dest/bkp-var-dpkg-backups.tar.gz /var/backups
# Dotfiles
cd /root
tar cpvzf $dest/bkp-root-dotfiles--restore-locally.tar.gz .[^.]*
cd /home/dave
tar cpvzf $dest/bkp-dave-dotfiles--restore-locally.tar.gz .[^.]*
}

ls $dest -al
df $dest
exit
o Backup entire system to a separate partition that won't be overwritten by a reinstall - #BEGIN bkpsys
Code:
#!/bin/bash

mount /dev/hda12 /mnt/extra
cd /mnt/extra/
mkdir bkps
cd bkps/

ls -l

bkpfname='hdb3-knoppix-32-intermediate-mostcfg-20030505'

dpkg -l >~/DEBInstalled.list

# XXX BACKUP DEB CACHE BEFORE RUNNING $0!!
#apt-get clean

time updatedb

time tar \
  --exclude=/mnt/* --exclude=/proc \
  --exclude=/cdrom --exclude=/floppy \
  --exclude=/.journal --exclude=/lost+found \
  -cvf - / | \
   gzip -9cv >$bkpfname.tar.gz

ls -l
o Now, reinstall latest Knoppix version. When done, **modify for your personal system** and then use the following script to recover necessary files from the backup: #BEGIN migratcrit
Code:
#!/bin/sh

# BACKUP ORIG ETC 1ST BEFORE RUNNING THIS!!

usetar=~/p233-etc.tar.gz

cd /

tar xzvf $usetar \
  etc/apt/sources.list \
  etc/init.d/boot.local etc/rc5.d/S98bootlocal \
  etc/init.d/console-screen.sh \
  etc/ftpusers etc/inittab etc/inputrc etc/issue \
  etc/login.defs etc/profile.local etc/proftpd.conf etc/securetty \
  etc/squid etc/squid.conf \
  etc/ssh/sshd_config etc/sudoers etc/syslog.conf etc/timezone

#        - DID NOT migrate: (mostly due to security)
#         /etc/ppp/* , /etc/hosts, /etc/inetd.conf, /etc/issue,
#         /etc/resolv.conf, wvdial.conf.

# console-screen.sh - fix screen font
# inetd.conf ?
# issue - for security
--THEN, go thru and start deleting packages you don't need, this time with --purge. See this thread ( http://www.knoppix.net/forum/viewtop...urgedebs#21452 ) for another script that you can modify for personal use. (Notice it already has the --purge included.) I use this script for fresh installs, really helps to get the system where I want it quickly.

--And now, a final word of advice. Start logging *EVERY SINGLE CHANGE* that you make to your system as root. You're a sysadmin, after all. If you delete/add a package outside of apt-get upgrade, TRACK IT. If you're really paranoid, write a script frontend to apt-get that logs all your parameters. (In fact, I should do this myself.) If you change a config file, write down what it was, and why. I do this with a file, /root/localinfo.dat that goes in the critical backup. This can help when something goes wrong, or you need to recreate what you did on another install.

Quote Originally Posted by Heavy-G
But that would take an awful lot of time, plus, I don't remember all of the packages that have been installed
Is there a list somewhere on my system with all the packages I ever had maybe? Then I could write a script that compares that list with the packages that I have at the moment, and do a dpkg --purge if it's not there anymore..