this is obsolete doc -- see http://doc.nethence.com/ instead
Manually ghost and rescue
Preparation
To get the best compression ratio, zero the empty space on each filesystem or partition.
On UNIX,
cd path/to/mount_point
dd if=/dev/zero bs=1024k of=dummy.2000
#cat /dev/zero > /dummy.2000
rm -f dummy.2000
On Windows use Matthias's little Pascal program (http://www.feyrer.de/g4u/nullfile-1.02.exe),
nullfile-1.02.exe
Note. source : http://www.feyrer.de/g4u/nullfile-1.02.pas
Note. otherwise SDelete (http://www.microsoft.com/technet/sysinternals/FileAndDisk/SDelete.mspx) could do the job,
rem sdelete -c
rem sdelete -c d:
Note. don't use 'cipher /W:C:', the subsequent passes don't write zeros but 0xFF, random numbers, ...
Ghost with NetBSD through NFS
Boot with NetBSD installation CD or memory stick and exit to the prompt.
Look for network interfaces and configure your network,
ifconfig -a
dhclient fxp0
Mount some NFS share,
cd /
mkdir -p install
mount -t nfs NFSSRV:/path/to/install install
cd install
Ghost the whole MBR including the partition table,
dd if=/dev/rwd0d bs=512 count=1 of=hostname.mbr
now choose which slice(s) vs. BSD partition(s) you need to ghost and proceed,
fdisk wd0
disklabel wd0
dd if=/dev/rwd0e ibs=1m | gzip -1 > hostname.rwd0e.gz
To restore the whole MBR including the partition table,
dd if=hostname.mbr of=/dev/rwd0d
check for slices, BSD partitions and restore,
fdisk wd0
disklabel wd0
dd if=hostname.rwd0e.gz ibs=1m | gzcat > /dev/wd0e
Ghost with Slackware through NFS
Boot with Slackware Linux installation CD or usbboot.img.
Automaticly enable your network card (Slackware script),
network
then look for your network interface and perform a DHCP request,
ifconfig -a
dhcpcd eth0
Mount some NFS share,
cd /
mkdir -p install
mount -t nfs-o nolock NFSSRV:/path/to/install install
Note. no rc.d/rc.rpc init script on the install media, hence the nolock option
Ghost the whole MBR including the partition table,
dd if=/dev/sda bs=512 count=1 of=hostname.mbr
now choose which DOS partition(s) you need to ghost and proceed,
fdisk -l /dev/sda
dd if=/dev/sda1 bs=1m | gzip -1 > hostname.sda1.gz
To restore the whole MBR including the partition table,
dd if=hostname.mbr of=/dev/sda
check for DOS partitions and restore,
fdisk -l /dev/sda
dd if=hostname.sda1.gz bs=1m | gzcat > /dev/sda1
The NetBSD G4U method
With NetBSD installation CD or memory stick, we got USB w/o the need to recompile G4U.
To ghost,
cat > ftpput <<EOF9
#!/bin/ksh
tmpfile=$1
gzip_opts=$2
[[ ! -f $tmpfile ]]
then
echo Usage: $0 tmpfile gzip_opts
exit 1
fi
( cat $tmpfile
dd bs=1m | gzip $gzip_opts
) | ftp -n
EOF9
cat > tmpfile <<EOF9
open FTPSRV
user FTPUSER FTPPASS
bin
put - hostname.rwd0d.gz
bye
EOF9
dd if=/dev/rwd0d ibs=1m | progress sh ftpput tmpfile -1
Note. if you stop and reexecute the command, the transfer starts over and the file gets rewritten
To restore,
#ftp -o "| progress -z dd obs=1m of=/dev/rwd0d" ftp://FTPUSER@FTPSRV/install/hostname.rwd0d.gz
Note. netcat is also an option.
Alternatives through NFS
To ghost,
#gzip -1 < /dev/wd0e > hostname.wd0e.gz
#gzip -1 < /dev/sda1 > hostname.sda1.gz
To restore,
#gzcat < hostname.rwd0e.gz > /der/wd0e
#gzcat < hostname.sda1.gz > /der/sda1
Alternatives through SSH/RSH
To ghost,
#gzip -1 -c /dev/sda1 | time ssh SRV cat '>'/install/hostname.sda1.gz
#dd if=/dev/sda1 bs=1m | gzip -1 | time ssh SRV cat '>'/install/hostname.sda1.gz
#gzip -1 -c /dev/sda1 | (ssh SRV "cd /install && cat > hostname.sda1.gz")
Note. try RSH instead of SSH
Note. for XEN P2V guest images, do not compress,
#dd if=/dev/sda1 bs=1m of=hostname.sda1
To restore,
#time ssh SRV cat /install/hostname.sda1.gz | gzip -dc > /dev/sda1
#(ssh SERVER "cat /install/hostname.sda1.gz") | gzcat > /dev/sda1
Software
There's a few tools available to automate the process :
- G4U
http://www.feyrer.de/g4u/
note. to create an image with G4U,
uploaddisk SRV /install/hostname.rwd0d.gz
- G4L
http://sourceforge.net/projects/g4l/
- SystemRescueCd & Partimage :
http://www.sysresccd.org/Main_Page
http://www.partimage.org/
- CloneZilla
- mkCDrec
- Mondo Rescue
References
http://www.feyrer.de/g4u/
http://www.usenet-forums.com/linux-general/83847-bash-progress-bar-command-like-g4u-bsd.html