On Thu, Feb 1, 2018 at 9:28 AM, Ultramedia Libertad <meloa...@gmail.com> wrote: > the disk with the partition /var to dead then we have replaced it, but > accidentally and stupidly I lost some sections of /var as /var/db so now I > try to verify the install and uninstall packages but I can not go away > /var/db/pkg
This is a lesson that many people learn the hard way -- always have backups. If you had a full backup of /var you would not have this problem now (this doesn't help you now, I say this only for others reading this message). The simplest thing to do is to simply create the /var/db directory and see if the package tools will automatically recreate the /var/db/pkg file. But this solves only one problem, who knows how many other things are broken due to missing /var files? Might as well do the job right and try to fix everything now. So the best path forward if you have no complete backup of /var is to get a fully populated /var partition from somewhere else, back it up, then restore it on this system. One way to do this is to use the copy of /var that is in the OpenBSD installer: back up everything, completely reinstall OpenBSD on this system from scratch (which will fully populate /var), then restore the files you care about. Another option (you might prefer this) is to do a fresh install of OpenBSD (same version, same architecture, probably amd64 or i386 in your case) onto a small disk (a USB thumb drive will do) then use tar to make a backup of /var (cd /var; tar cfz /home/var-backup.tar.gz .), then use that to restore the default contents of /var (mkdir /var/restore; cd /var/restore; tar xpfz /some/path/var-backup.tar.gz). You can then start moving things you need from /var/restore to var (for example mv /var/restore/db /var/db). I would not use dump/restore for this kind of task because restore works best restoring onto a blank file system, but your 3TB /var probably already has other files in it already. You could also extract the missing /var files directly from the installation sets but I don't advise going down this path unless you really know what you are doing. It is certainly not something I would feel comfortable instructing others to do. If I recall correctly the installation sets are just tar files. -ken