cleaning out /var/backups

I find a lot of old, mostly dpkg, files in /var/backups. Some over a year old. I see in a cron file where dpkg creates the files as backup, but don't see anywhere that they're ever removed. Shouldn't there be one?

1

2 Answers

I think you are referring to the files created by /etc/. It should only create 7 versions of each file. These 7 files can go back years because new files are only created if something changes.

The cron script show that the number of backups is hardcoded (therefore not configurable) and includes the comment

# Backup the 7 last versions of dpkg databases containing user data.

If you see more than 7 versions of the files then there is a bug in the script.

1

Rationale

3.3 Installed Packages

There are two lists of installed packages available on Debian. The original file these lists are created from is /var/lib/dpkg/status. This file must not be corrupted, or otherwise your system is hosed. This is the main database for the package manager dpkg.

The Debian package system keeps an older copy from the last but one dpkg run in /var/lib/dpkg/status-old. In order to preserve the system for greater damage upon a crash or filesystem corrupting a daily backup of this file is created into /var/backups when the file differs from the last copy. The backup code is in /etc/.

The informal list is created by the command dpkg -l or by starting dselect and using the Select item. Or by using any of the other package manager front ends. This list consists of the name of the package (stripped down to some 40 characters), the installed version of each package and a short description. This is intended to be human readable.

For technical purpose you can make dpkg to generate a list of packages and their selection status (i.e. install, hold and deinstall). This is created by dpkg --get-selections. This output is intended to be parsed by a program again, such as dpkg --set-selections which will change the status of packages in its internal database. The dselect-upgrade action from apt-get will install all new packages afterwards.


Shouldn't there be one?

It is better to have backups and not need then then not having backups and needing them. It is better left to the user then to automate it but that is just my opinion.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like