Here's my notes on partimage from the command line. I didn't include the save option but it shouldn't be too much different.
EDIT: Running partimage in batch mode to
save the partitions would look something like this .....
partimage save -c -b -d -z2 -f3 /dev/hda2 /mnt/images/backup/linux
or
partimage save -B=foo -c -b -d -z2 -f3 /dev/hda2 /mnt/images/backup/linux
If you are going to clone an NTFS partition, you may want to run defrag and scandisk first.
Get a cd bootable version of linux like system rescue at
http://www.sysresccd.org and bootup with that cd.
Mount the partition where the images are going to be saved to.
mount /dev/hdb1 /mnt/images/backup -t ext3
Run partimage to make the images and save it to the backup directory which was created in the previous step.
In this example, I have a dual boot system so I backed up both operating systems with partimage.
Save the ENTIRE PARTITION TABLE to a file using sfdisk.
sfdisk –d /dev/hda > /mnt/images/backup/partfile
If you have an Extended partition, sfdisk may give you an error when you try to restore. In this case, it's better to use dd to backup and restore the partition table.
dd if=/dev/hda of=/mnt/images/backup/mbrfile bs=512 count=1
The clone script will restore that partition table and MBR from files to the new hard drive using the commands:
sfdisk /dev/hda < /mnt/images/backup/partfile
or
dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1
After you have saved the images and the partition table, install the new hard drive, make sure that bios sees it as the /dev/hda ( Primary Master ) so you don’t accidently zap your backup images which are saved on the /dev/hdb ( Primary Slave ) .
Bootup with the rescue cd and run the clone script to restore the images to your new hard drive.
Code:
#!/bin/bash
#
clear
echo
echo "********************************************************************"
echo " Caution!!! This program will erase your hard drive"
echo
echo -n " Do you want to proceed (Y/N)?"
read answer
if test "$answer" != "Y" -a "$answer" != "y";
then exit 0;
fi
#
clear
#
#Erase the old boot sector
dd if=/dev/zero if=/dev/hda bs=512 count=1
#
#Restore the partition table from file using sfdisk
sfdisk /dev/hda < /mnt/images/backup/partfile
#
# Restore the partition table from file using the dd tool
#dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1
clear
#
#Restore the images with Partimage
partimage restore -b -z2 -f3 /dev/hda1 /mnt/images/backup/windows.000
#
partimage restore -b -z2 -f3 /dev/hda2 /mnt/images/backup/linux.000
#
clear
echo "Image restore is complete"
echo
#
#####End