I used to use the dpkg --get-selections method to save the list, then use --set-selections to reload them for installation. It worked ok, but included all packages, not just those I'd manually added.
Then came across apt-mark showmanual which only lists manually installed packages, which is much less than the total list. Sometimes package dependencies change, so there are sometimes packages in the full list that aren't really needed and I'd rather not have all of them marked as "manually installed." To restore/install packages on the restored system (last step in recovery process), use:
Code:
######[ to restore pkgs ]#######
sudo apt-mark manual $(cat apt-mark.manual)
sudo apt-get -u dselect-upgrade
Guess in the big picture, it doesn’t matter exactly how it is done, provided the method works.
The package list saving command used in my backups is:
Code:
/usr/bin/apt-mark showmanual > /root/backups/apt-mark.manual
System admin scripts are kept in /root/ on my systems for consistency. The /root/backups/ holds backup data that might be helpful later:
Code:
root@hadar:/root/backup# ls
apt-mark.auto crontab.tf dpkg.list pvdisplay.txt
apt-mark.manual crontab.root lshw.list vgdisplay.txt
blkid.txt df.txt lvdisplay.txt
Everything there is updated nightly, just before the backups are performed. Sometimes those commands are easier to use than the config data in /etc/, which is always part of backups too. I use lvm extensively, especially for VM storage. I should probably add parted -lm and lsblk -o name,size,type,fstype,mountpoint to those files. Having the exact partition layout can be helpful, though I've never needed it.
Anyway, for me the actual backup of files is just the last part of the backup process. Getting current information about the system, users, settings, and either deleting or ignoring useless cache stuff happens just before. After all, there is little use in backing up ~/.Trash/, right?
Bookmarks