Pages

Monday, February 6, 2012

Backup an RPM Database in Red Hat Linux

Share it Please
Red hat linux maintains an rpm (Red hat Package Manager) database which gets accessed whenever an rpm command is issued. The database is modified when a new package is installed.

The rpm database is located in /var/lib/rpm.The files in this are binary files which holds information about the installed packages.

In this article we will see on how to backup the rpm database in red hat linux, but before taking a backup we need to make sure that no process is currently using any files within this directory,

lsof | grep /var/lib/rpm

Any files that are currently used within this location should be stopped before continuing.
Once we are sure that no files are being accessed currently, the next step is to remove the lock files. These lock files are left behind by a process attempting to access the rpm database. use,

 ll /var/lib/rpm

Lock files begin with double underscore character followed by db ( __db ).If there are any lock files we can remove them using

rm -f /var/lib/rpm/_db*

Once the lock files are removed we can make a back up of the rpm database using

tar czvf /root/Desktop/rpmDatabase.tar.gz /var/lib/rpm/

More articles to come…

No comments :

Post a Comment