-   Linux - Newbie (
-   -   NewB need help with partimage (

shahin123 05-15-2008 08:36 AM

NewB need help with partimage

I have a problem with cloning my debian box,

I did install debian on a computer,every thing is on one partition when I run cfdisk I see hda1 as boot and primery and hda5 as logical linux swap. now I want to clon this box to othere box with the same hardware.

I did add secound drive to my debian box then format then create a partition on it and formate it with ext3 file system.

I did these steps:
hdc1 is the new drive

with cfdisk
1. mkdosfs -F 32 /dev/hdc1
2. mkdir /mnt/hdc1
3. mount /dev/hdc1 /mnt/hdc1

hda is the oregianl drive with debian installed on it

dd if=/dev/hda of=/mnt/hdc1/my-hda.mbr count=1 bs=512

sfdisk -d /dev/hda > /mnt/hdc1/my-hda.sf

then use partimage and create a image of hda1 to hdc when I run
ls -l /mnt/hdc1

i can see


I did remove the hdc disk the one with image to the new box and in stall it as a primery dirve in this box I have othere empty drive so I did create a partition on the new drive and format it with ext3 file system.

then did these

dd if=/mnt/hdc1/my-hda.mbr of=/dev/hda
sfdisk /dev/hda < /mnt/hdc1/my-hda.sf
mkswap /dev/hda3

and with partimag

I put the sda1-image.000 to the new drive.

but when I reboot the box I get the error there is not boot device in the box (removed the drive with image).

Any idea what I do wrong here=



kscott121 05-15-2008 10:30 AM

I have been experimenting along the same lines using the following tutorial:

I have seen the same result as you in some instances. Not sure the causes, once saw that the newly partition table was FAT (not ext3) and the swap was undefined. In another case, the grub menu.lst iel had to be changed from sda to hda (or vice versa). I don't have a handle on exactly how to do it reliably although I need to figure it out to clone a system multiple times.

K Scott

David1357 05-15-2008 10:46 AM


Originally Posted by shahin123 (Post 3154055)
Any idea what I do wrong here?

Yes. It looks like you did a lot of things wrong. Instead of nit-picking every little thing, I will tell you what you need to do.

Use fdisk to partition your second drive (hdc). Start fdisk like this

# fdisk /dev/hdc

Use the 'n' command to create a new partition. Press 'p' to create a primary partition. Select '1' for the first partition. Make the size at least as big as your current partition. Leave enough room for a swap partition. Use the 't' command to change the type to ext3 (83) and make it bootable using the 'a' command.

Use the 'n' command to create your swap partition. Press 'p' to create a primary partition. Select '2' for the second partition. Make the size at least twice the size of your system RAM. Use the 't' command to change the type to swap (82).

Use the 'w' command to save your changes and exit fdisk.

Use partimage to restore your saved image. You can do this from the command line using

# partimage -b restore /dev/hdc1 /path-to-image/sda1-image.000

Mount your restored partition using these commands

# mkdir /mnt/system
# mount -text3 /dev/hdc1 /mnt/system

Install grub on your boot record using this command

# grub-install --recheck --root-directory=/mnt/system /dev/hdc

Unmount the restored partition using this command

# unmount /mnt/system

You should now be able to put the hard drive in the new system. You might have to modify "/boot/grub/menu.lst" to get the hard drive mapping correctly, but this is not usually the case.

shahin123 05-19-2008 06:05 AM

I did solve this issue in 2 ways,

After finishing putting the image on the new H.D :

1. Run fdisk /mbr

2. Install the grub from my debian install disk, by starting in rescue mode.

So thanks for all your info on this subject,


All times are GMT -5. The time now is 12:53 PM.