It is possible to create an image by copying data from a real disk. If the disk to be copied contains an operating system, you must have at least two operating systems on the machine, since the partition that should be copied should not be in use or mounted.
Before making a copy of a disk, some information about the disk should be gathered:
These numbers can be obtained using the fdisk utility.
You can choose to make a copy of the whole disk or just a partition from the disk using the dd utility. Example:
dd if=/dev/hdb of=hdb_disk.img
The next step is to prepare the target configuration so it can use the new disk. For x86 targets, the dredd machine has a $disk_files parameter that can be set to a list of files to use in the image object of the boot disk, and also $disk_size that specifies the size of that disk.
$disk_size = 1056964608 $disk_files = [["hdb_disk.img", "ro", 0, 1056964608, 0]]
For other machines, that do not have these parameters, attributes in the the disk object and its corresponding image objects have to be set instead.
Make sure to set the $disk_size correctly to reflect the size of the disk that has been copied. If only a partition has been copied, the offset where the partition starts, and the size of the partition, should be set in the file list. If the whole disk has been copied, the offset is zero and the size should be the size of the whole disk. Several partitions can be combined to form the complete disk, as described in section 7.1.6.
For an x86 machine, the system component will automatically set the BIOS geometry for the C: disk. It can also be set manually:
simics> system_cmp0.cmos-hd C 1023 16 63