[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Crash of the /var partiotion



On Sat, May 03, 2003 at 01:03:06PM +0200, Nils-Erik Svangård wrote:
> Hi!
> Last night my /var partiotion crashed /dev/hda8, everything is gone.
> I have some questions.
> *Can I revocer some files? I have cat /dev/hda8 > file
> *Can I regenerate the debian dselect data so I dont have to reinstall
> everything. (The computers works now.. I have just added the /var/log
> dir whcich was gone, and prevented X from starting.

See http://www.linuxworld.com/2003/0113.petreley.html

There are a few discussions of this in archives. Here is script from
Karsten M. Self that appeared in one of those discussions that should
regenerate dpkg status file which one of first things you need to
do. I have never had to do this so
have not tested it myself:

#!/bin/sh
    export PATH=/usr/sbin:/usr/bin:/sbin:/bin

    # Let's be verbose....
    set -v

    # Create /var directory tree stubs
    mkdir /var/cache/apt/archives
    mkdir /var/cache/debconf
    mkdir /var/log
    mkdir -p /var/lib/dpkg/{info,parts,alternatives,methods,updates}

    # Create a rudimentary status file
    # change Version to match that of libc6 you have installed
    cat <<-EOF>/var/lib/dpkg/status
    Package: libc6
    Status: install ok installed
    Version: 2.3.1-9
    EOF

    # Update package cache
    apt-get update
    apt-get dist-upgrade

    # Register as installed crucial packages.
    dpkg --clear-avail
    apt-get update
    apt-get dist-upgrade
    cd /var/cache/apt/archives
    dpkg -i libncurses*
    dpkg -i perl-base*
    dpkg -i libstdc++*
    dpkg -i dselect*
    dpkg -i dpkg*

    # Reinstall libc to register it.
    apt-get install --reinstall libc6
                  
    # Reinstall base packages.
    apt-get dist-upgrade

    # Generate list of installed packages to Re-register previously
    # installed packages as installed, using /usr/share/doc as a
    # fallback package registry.
    dpkg --set-selections $(
        ls /usr/share/doc | grep -v [A-Z] | awk '{print $1 " install"}'
    )

    # Re-register everything.
    apt-get dist-upgrade


> *What can I do to prevent this ever happening againg.

Backup certain important file in /var. The minimum is probable dkpg
status file and /var/backups.

-- 
Jerome

Attachment: pgpWR6mnHLAlm.pgp
Description: PGP signature


Reply to: