This site is now 100% read-only, and retired.

Question: /var is gone, now what?

Posted by pm on Thu 6 Oct 2005 at 12:16

This is another story to prove that you should have backup of the system burned on removable media. I had installed /var on separate drive and that drive died last night.

Question: is there any smart way to re-create /var structure?

Of course I can create folders hierarchy (/var/log, /var/run, etc.) or I can even copy /var from some other debian system, but how do I re-create /var/lib/dpkg/status to get apt running?

Not to mention all other applications that keep their data under /var. Any hints?

Brgds,
Piotr

 

 


Re: Question: /var is gone, now what?
Posted by Anonymous (62.180.xx.xx) on Thu 6 Oct 2005 at 13:12
Have a view at debian-referance package, there is a small chapter how to workaround your problem

/admir trakic

[ Parent ]

Re: Question: /var is gone, now what?
Posted by Steve (82.41.xx.xx) on Thu 6 Oct 2005 at 13:19
[ View Weblogs ]

Good call!

The relevent section is:

Steve
--

[ Parent ]

Re: Question: /var is gone, now what?
Posted by pm (83.31.xx.xx) on Thu 6 Oct 2005 at 18:30
Thanks! This helps. One chapter above the one pointed by Steve is an excellent solution to lost /var/lib/dpkg/status.

Brgds,
Piotr

[ Parent ]

Re: Question: /var is gone, now what?
Posted by suspended user wolfrider (67.184.xx.xx) on Sun 16 Oct 2005 at 12:51
After reading an article about this very situation some time ago (probably linxgazette.net), I incorporated this into a bkpcrit script that goes to 100MB Zip drive:

( Note: All of my /mnt/* dirs have a NOTHERE file in the directory if nothing is mounted there. To create, simply ' touch /mnt/zippy/NOTHERE ' before mounting anything to that dir. )

BEGIN /root/bin/bkpcrit:
#!/bin/sh
# Backup critical files (hopefully)

stime=`date`
dest='/mnt/zippy'
mount $dest

[ -e "$dest/NOTHERE" ] && echo "$dest NOT MOUNTED" && exit 99

# "If" checking for NOTHERE file...

dest=$dest'/bkpcrit-p500-hda6-knoppix26'
echo $dest = PK
read

mkdir -p -v $dest

# Copy this bkp script to zippy
cp $0 $dest
cp ~/localinfo.dat $dest
cp /etc/fstab $dest
cp /etc/inittab $dest

tar cpvzf $dest/bkp-ETC-debian.tar.gz /etc
tar cpvzf $dest/bkp-DEV-debian.tar.gz /dev
tar cpvzf $dest/bkp-root-debian.tar.gz /root
tar cpvzf $dest/bkp-davesrc-debian.tar.gz /home/dave/src
tar cpvzf $dest/bkp-davebin-debian.tar.gz /home/dave/bin
tar cpvzf $dest/bkp-usr-local-bin-debian.tar.gz /usr/local/bin
#tar cpvzf $dest/bkp-usr-local-src-debian.tar.gz /usr/local/src
tar cpvzf $dest/bkp-var-dpkg-status.tar.gz /var/lib/dpkg
tar cpvzf $dest/bkp-var-dpkg-backups.tar.gz /var/backups
#/var/adm/inst-log

# Dotfiles
cd /root
tar cpvzf $dest/bkp-root-dotfiles--restore-locally.tar.gz .[^.]*

cd /home/dave
tar \
--exclude='.kde/share/thumbnails' \
--exclude='.kde/share/cache' \
--exclude='.opera/cache4' \
--exclude=".mozilla/firefox/*.default/Cache" \
--exclude='.gqview' --exclude='.thumbnails' \
--exclude='.pan/*' \
-cpvzf $dest/bkp-dave-dotfiles--restore-locally.tar.gz .[^.]*

tar cpvzf $dest/bkp-usr-src-cfgs.tar.gz /usr/src/*.cfg

sync

ls $dest -al
df $dest
echo $stime' --> '`date`
exit

[ Parent ]