I had created a backup.img file from a hard disk having two partitions. Now I want to write these partitions to another hard disk. But the problem is I don't know how? If I use dd than it write the complete backup.img file to one partition and then I see nothing there. Please help.
Edit 1 dd if = /XXX/backup.img of = /dev/sdb1
Actually sdb have many partitions so I can not write backup.img to complete disk.
If you made the image of the whole drive for example
/dev/sdb
then you should restore it to a whole drive.But if you made the image of a partition for example
/dev/sdb1
, then you should restore it to a partition.You can check for the content of the image file with
kpartx
. It can see directory structure, if there is one (and not only a file system sitting at the head end of the image). See this example,Map:
Delete map:
Please notice that the devices for partitions will probably look like this, when seen by other tools:
Another example,
When you know what you have, you will also know how to clone the content. But it is also possible to mount a mapped source partition and the target partition and extract files (copy them with
rsync
or some other program).