interface=eth0
dhcp-range=192.168.1.2,192.168.1.254,1h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/var/lib/tftpboot
default menu.c32
prompt 0
menu title PXE Boot Menu
MENU AUTOBOOT Starting Local System in # seconds
label local
menu label Boot from local disk
menu default
localboot 0
timeout 100
label sysrcd
menu label Boot SystemRescueCD over the network
kernel sysrcd/rescuecd
append initrd=sysrcd/initram.igz setkmap=us vga=5 boottftp=tftp://192.168.1.1/sysrcd/sysrcd.dat
/srv/images 192.168.1.*(rw,no_root_squash)
mount -t nfs 192.168.1.1:/srv/images /mnt/custom
#!/bin/sh
function error_exit {
# Display error message and exit
echo "$1" | tee /root/image.log
exit 1
}
function show_status {
# Display next operation and pause
echo "$1..."
sleep 3
}
IMAGE=$1
DEVICE="/dev/sda"
SWAPPART="${DEVICE}1"
LINUXPARTNUM="2"
LINUXPART="${DEVICE}${LINUXPARTNUM}"
MOUNTPOINT="/mnt/local"
if [ $# -ne 1 ]
then
error_exit "Must specify path to image"
fi
show_status "WARNING: About to overwrite all data on the first hard disk"
show_status "Disabling swap"
swapoff -a || error_exit "$LINENO: Couldn't deactivate swap"
show_status "Erasing partition table"
parted -s $DEVICE mklabel msdos || error_exit "$LINENO: Couldn't create new partition table"
show_status "Creating and enabling swap"
parted -s $DEVICE mkpart primary linux-swap 0GB 0.5GB || error_exit "$LINENO: Couldn't create partiton for swap"
sleep 1
mkswap -L swap $SWAPPART || error_exit "$LINENO: Couldn't make swap"
sleep 1
swapon /dev/sda1 || error_exit "$LINENO: Couldn't activate swap"
show_status "Creating linux partition"
parted -s $DEVICE mkpart primary ext2 0.5GB 100% || error_exit "$LINENO: Couldn't create partiton for linux"
parted -s $DEVICE set $LINUXPARTNUM boot on || error_exit "$LINENO: COuldn't amke linux partiton bootable"
show_status "Restoring linux from system image"
partimage -b restore $LINUXPART $IMAGE || error_exit "$LINENO: Image failed"
show_status "Verifying then expanding linux filesystem"
e2fsck -f -p $LINUXPART || echo "$LINENO: Error $? encountered while checking linux filesystem, continuing anyway"
resize2fs -p $LINUXPART || error_exit "$LINENO: Couldn't expand linux filesystem"
show_status "Installing bootloader"
mount $LINUXPART "$MOUNTPOINT" || error_exit "$LINENO: Couldn't mount linux filesystem"
grub-install "--root-directory=$MOUNTPOINT" $DEVICE || error_exit "$LINENO: Couldn't install grub"
show_status "Finished! Shutting down."
halt
mount -t nfs 192.168.1.1:/srv/images /mnt/custom
Single Disk will back up all the supported partitions on the first disk drive detected by FOG, but the partitions are NOT resizable by FOG. This means that the image must be restored to a disk of the same or larger capacity. It is possible to backup NTFS drives with vendor specific 'restore' partitions with this type of image.
It is possible to backup Linux systems with this type of image given the following criteria:
* There is a Grub boot loader present.
* LVM is not used.
* The partitions include ext2, ext3, reiserfs, or swap.
Linux support is still pretty primitive, and has only been tested with a default Ubuntu 8.04 Installation.
posted by icebourg at 11:42 AM on January 6, 2009