glucopy-glurestore 1.1

A set of scripts for copying and restoring a fully functional GNU/Linux (or other Unix-like) system
glucopy-glurestore is a set of scripts for copying and restoring a fully functional GNU/Linux (or other Unix-like) system.

The glucopy script will back up all system content (system and user files), while the glurestore script will partition and format an identical system, restore the system and user files, and make the system bootable.

glucopy-glurestore scripts are included in the HTML documentation.

The back-up should (ideally) be made while the system is not running, which usually means that you need to boot with a rescue system disk. A number of suitable floppy or CD-based system images can be downloaded from the net or, better, included in your distribution's boot options. Make sure that this rescue system supports the type of disks in your target system (SATA/SCSI or IDE).

The following script will get partition information in a form that can be used to restore the system on new disks and will then collect the working system files in one (or more) compressed tar balls.

The sfdisk program is used for getting partition information (-d option). Take a look at sys_partitions.txt after the glucopy.sh script has finished.

In this application it is considered that all Master Boot Record (MBR) information will be overwritten by the partitioning and boot loader programs. If you need a copy of all or parts of the MBR, however, dd is your friend.

System directories that contain transient information (e.g. /proc, /sys) are not copied. Directories or individual files containing unwanted information can be excluded using tar's –exclude=/directory/file option.

#!/bin/sh
###########################
# glucopy.sh
#
# Creates the /glucopy directory
# Copies partition information in sys_partitions.txt
# Optionally makes a copy of the MBR in mbr.bin
# Copies working GNU/Linux system to .tgz files
#
# USAGE:
# Boot system with a rescue CD or any bootable CD
# that supports your type of disks (SATA/SCSI or IDE).
# run the back-up script: ./glucopy.sh
#
# In this example the system is on /dev/sda
# /dev/sda1 is a small partition with HW manufacturer utilities
# /dev/sda2 has system root (/) -> mounted to /mnt
# /dev/sda3 is a spare (blank) partition
# /dev/sda4 has home (/home) and space to hold
# the information to be copied -> mounted to /mnt2
#
# 061116 jp/dm
###########################
# Change the following to reflect the place where your system root (/)
# and the home directories (/home/*) are mounted
mkdir /tmp/mnt1
mkdir /tmp/mnt2
mount /dev/sda2 /tmp/mnt1
mount /dev/sda4 /tmp/mnt2

# The directory to hold the system copy is placed on the larger partition
mkdir /tmp/mnt2/glucopy

# Change to the working directory
cd /tmp/mnt2/glucopy

# Optionally copy MBR information
#dd if=/dev/sda of=mbr.bin bs=512 count=1

# Copy partition information
/sbin/sfdisk -d /dev/sda > sys_partitions.txt

# Make tarballs
tar -C /tmp/mnt1 -cvzf syscopy.tgz boot bin etc lib media opt root sbin usr var dev

# Move up a level
cd ..
# here we are under the /home directory level
# notice that --exclude will exclude anything that matches a _pattern_
# the glucopy directory will still be created in the tarball
tar -cvzf ./glucopy/homecopy.tgz * --exclude=glucopy/*

# Copy the backup/restore scripts (here under root /), and the sfdisk program, as well
cp /glucopy.sh ./glucopy
cp /glurestore.sh ./glucopy
cp /sbin/sfdisk ./glucopy

# Notify user
echo -e “glucopy: finished a”

last updated on:
March 30th, 2012, 9:56 GMT
price:
FREE!
developed by:
Dimitri Marinakis and John Poulakis
license type:
(FDL) GNU Free Documentation License 
category:
ROOT \ System \ Archiving

FREE!

In a hurry? Add it to your Download Basket!

user rating 21

UNRATED
2.7/5
 

0/5

What's New in This Release:
  • This version adds RAID preparation, backup, and restoration, and persistent device attribute considerations (UUIDs, MAC addresses, initrd, and GIDs).
read full changelog

Add your review!

SUBMIT