Are there any tools to help create a disk image de novo?

One way to create a disk image is to use an existing disk.  For
example, let's say I have a disk /dev/sda and it has four partitions.
I could create an image of the entire drive like so:

$ sudo dd if=/dev/sda of=sda.img

That will image the entire drive, including the MBR, the partition
table, all partitions, and their included data.

Also, I can create a filesystem image de novo, like so:

$ dd if=/dev/zero of=sda1.img bs=1M count=1000
$ sudo mkfs.ext3 sda1.img

That will create a 1 GB file and format it as an ext3 filesystem.

In theory, then I should be able to create the sda.img de novo also by
creating four filesystem images (sda{1..4}.img) and then somehow tying
them together with a made-up MBR and partition table.  In pseudo-code,
something like this:

$ cat MBR.img partition-table.img sda1.img sda2.img sda3.img sda4.img > sda.img

And in theory, one should be able to do the reverse: given a disk
image, pull out the MBR, partition table, and all partitions.

Anyone know of an easy way to do this?

Regards,
- Robert

-- 
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug

Reply via email to