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

RE:backup script was Kernel Panic~



Russell, Thanks, I've been trying to get a grasp of this, I'm sure this will
help!

Best Wishes!
Mike Olds www.buddhadust.org

-----Original Message-----
From: Russell [mailto:rjshaw@iprimus.com.au]
Sent: Sunday, October 13, 2002 6:55 PM
To: debian-user@lists.debian.org
Cc: debian-user@lists.debian.org
Subject: Re: Kernel Panic~: Rebuild Kernel: miniHOWTO draft .001


Michael Olds wrote:
>
> Russell,
>
> Ok...I am going to remake my package...without initrd as I thought it not
> such a good idea to have my main file system as a module and so included
it
> in the kernel.
>
> You say: Backup your HDD. Easy for you to say: I come from Windows where I
> press two buttons on Drive Image to backup my whole system. Here I have
been
> working for a month just to try and set up so I can use partimage!

I learnt some bash scripting and made this to backup onto a removeable
hard-disk (had some help from a previous poster on this group). Don't
use it until you understand how it works and what it assumes. I use
it from /root, and just type ./backup

#!/bin/sh

# Copy everything (almost) from the system to a backup removeable hard-disk
# Assumptions:
#  The spare hard-disk has enough capacity
#  The spare disk is suitably partitioned and set up.
#
# The spare disk won't be bootable unless lilo is run separately,
#  which i haven't got around to doing yet

# The backup /boot partition:
HDD_BOOT=hdc1

# The backup root / partition:
HDD_MAIN=hdc3

# Mount /boot partition
if [ ! -d /mnt/bootpart ]
then
  mkdir /mnt/bootpart
fi

if ! grep -qs /dev/$HDD_BOOT /proc/mounts
then
  if ! mount -t ext2 /dev/$HDD_BOOT /mnt/bootpart
  then
    echo "Removeable /dev/$HDD_BOOT not working"
    exit 1
  fi
fi

# Mount main partition
if [ ! -d /mnt/mainpart ]
then
  mkdir /mnt/mainpart
fi

if ! grep -qs /dev/$HDD_MAIN /proc/mounts
then
  if ! mount -t ext2 /dev/$HDD_MAIN /mnt/mainpart
  then
    echo "Removeable $HDD_MAIN not working"
    exit 1
  fi
fi

# Copy everything on main partition
# Strip some top level directories we don't want to copy
FILES=$( chroot / ls )

for i in $FILES
do
  if [ -d /$i ]
  then
    echo "Updating /$i"
  else
    echo "Updating $i"
  fi

  case "$i" in
  boot)
    if ! rsync -a --delete /boot /mnt/bootpart
    then
      echo "Failed to update /boot"
      exit 1
    fi;;
  cdrom)
    echo /$i | cpio -pdm /mnt/mainpart
    continue;;
  proc)
    echo /$i | cpio -pdm /mnt/mainpart
    continue;;
  floppy)
    echo /$i | cpio -pdm /mnt/mainpart
    continue;;
  mnt)
    echo /$i | cpio -pdm /mnt/mainpart
    continue;;
  esac

  if ! rsync -a --delete "/$i" /mnt/mainpart
  then
    echo "Failed to update /$i"
    exit 1
  fi
done

echo "System backup successful"
exit 0


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org




Reply to: