find-upgrade-orphans.sh

Modified on $Date: 2005/01/04 18:03:26 $

find-upgrade-orphans.sh is a shell script designed to help you upgrade your Linux installation. Many people make different partitions for their Linux systems, for instance putting /home on its own partition so that it can be left untouched when installing a new version of Linux. Some partitions really ought to be reformatted when installing a new version of Linux (especially if switching to a different distribution). Usually these partitions (especially /) contain important customized configuration files (as in /etc). Sometimes these partitions include software that was installed "by hand", or other software that wasn't part of the "official" Linux distribution.

find-upgrade-orphans.sh goes through your partitions and asks which will be reformatted when you re-install Linux. It then compiles a list of files (and devices, links, and fifos) on those partitions that have either been modified since you installed their package (e.g,, configuration files), or that do not belong to any package (e.g, software you installed yourself). It will tell you how much space is needed to back up these files, ad tell you which of the other partitions have enough room to hold the backed up files.

Note: this only works with RPM-based Linux distributions. It'll work fine if you're moving from an RPM-based distribution like Mandrake to a non-RPM system (like Debian), but not the other way 'round.

Sample interaction/output:

# find-upgrade-orphans.sh

Please indicate whether each of the currently mounted
partitions will be reformatted or not when you upgrade

                   /: will this be reformatted (Y|N)? Y
               /boot: will this be reformatted (Y|N)? Y
               /home: will this be reformatted (Y|N)? N
                /tmp: will this be reformatted (Y|N)? N
                /usr: will this be reformatted (Y|N)? Y
                /var: will this be reformatted (Y|N)? Y

This tool will look for files that should be preserved on
the following partitions:
        /       /boot   /usr    /var

The following partitions will be ignored by this tool:
        /home   /tmp

Is that alright (Y|N)? Y

17:32:56 finding all the files that belong to packages
17:33:44 finding all the packages
17:33:56 finding all the package files that have been modified
17:45:43 finding all the files on doomed / partition
17:45:52 finding the files on doomed / that are not owned by packages
17:46:11 / has 4500 orphans out of 12270 files
17:46:11 finding all the files on doomed /boot partition
17:46:11 finding the files on doomed /boot that are not owned by packages
17:46:25 /boot has 18 orphans out of 46 files
17:46:25 finding all the files on doomed /usr partition
17:47:40 finding the files on doomed /usr that are not owned by packages
17:48:55 /usr has 3409 orphans out of 165522 files
17:48:55 finding all the files on doomed /var partition
17:48:57 finding the files on doomed /var that are not owned by packages
17:49:13 /var has 1608 orphans out of 1790 files
17:49:13 finding the files we need to save
17:49:16 calculating size of files we need to save (this could take some time)

/tmp/dist-upgrade.16173/keep contains names of the 8591 files (259 MB compressed) you likely want to keep

/home has 3528 MB free and could hold the backed-up files
/tmp does not have enough space for the backed-up files
WARNING: /tmp is not recommended for important files. Some distributions flush /tmp
         when the system boots; others purge it periodcally.

To back up the files, use a command like this:
  umask 077 && tar czf /home/backups-200501031752.tar.gz -T /tmp/dist-upgrade.16173/keep

17:52:13 All done.