Using the program partimage you can make backups of many kinds of os partitions. Think of it as a free Norton Ghost. Well when you make a image of a partition with partimage you take a snapshot of the partition at a certian size. Using fdisk (the linux fdisk) you can see how man blocks of space the partition is using on the disk and what area they start at and end on. If you use the same disk to put your image back on it already has the partitions setup so you just restore it and away you go. Well when you want to restore your image to a new disk with no partition info on it you have to make sure your create a partition with equal to or more blocks than the orginal image. This is so your old image will fit into the new partition your creating.
I had a partition image that took up a total of 5 Gig of space on one partition. I wanted to put it on a new disk with a partition that was 250 Gig. Now this will work because the old image will fit into the new partition with room to spare. The problem is that the filesystem on the image was created using only 5 Gig of space. So that's all it knows about. So when you put 5 Gig partition image back into a 250 Gig partition the operating system only sees 5 Gig. Even though the partition is 250 Gig. So what are we to do?
We need to create the 250 Gig partition on the new disk. Put the 5 Gig partition image onto the new disk. Then resize the filesystem to it's new size. I had to do this with an ext3 filesystem. But there are no ext3 filesystem resizing programs. Well there is a way around that. This was done from a bootable linux distro. On an PATA harddrive. Below are the steps do it.
Make a partition on the new hd. Bigger than the one from the image. That's the whole point of this. I'm using parted to partition.
parted -s /dev/hda mkpart primary ext3 0 250G
Make a swap partition
parted -s /dev/hda mkpart primary linux-swap 250G 251G
Make partition 1 bootable
parted -s /dev/hda set 1 boot on
Create the swap area.
mkswap /dev/hda2
Use partimage to put your smaller partition image back. I have a partimage server setup to distribute images.
partimage -b restore --server=192.168.1.1 /dev/hda1 imagename.000
Now that the image is back on the partition we need to remove the ext3 journal essentially creating an ext2 fs.
tune2fs -O ^has_journal /dev/hda1
Do a file system check and fix.
e2fsck -f -y /dev/hda1
Resize the filesystem with resize2fs. In debian it's part of the e2fsprogs package.
resize2fs -p /dev/hda1
Make the ext2 fs an ext3 fs again.
tune2fs -j /dev/hda1
This is only if you need to put a boot loader like grub on. Just type "grub" and do the following commands. PATA hd's are hda SATA hd's are sda.
device (hd0) /dev/hda
root (hd0,0)
setup (hd0)
makeactive
quit