Dd and drive imaging

ddimage

When you image a drive with dd, you get a image usually of the same exact size of the drive. You can compress the image, but that is really Dependant on how many continuous null's or zeros their are on the drive. My question is, does another tool exist to only image the critical blocks of the drive. Such as with a fresh install of an OS, is it possible to only copy up to the last block utilized by the new os?

while I know dd doesn't have such abilities, does such already exist, and if it does then does that app use dd.

Best Answer

For quick and dirty sort-of imaging of a Windows box, I boot a SystemRescueCD, and execute the following script (located on an external USB backup drive mounted on /mnt/backup):

 #!/bin/bash

 PCNAME=foobar # or passed in on command line if you prefer

 fdisk -l /dev/sda >./${PCNAME}-fdisk-l.txt
 dd if=/dev/sda of=./${PCNAME}-mbr.bin bs=512 count=1
 dd if=/dev/sda1 of=./${PCNAME}-p1-diag.bin bs=23040
 ntfsclone -s -o - /dev/sda2 | gzip -c | split -b 638m - ./${PCNAME}-p2-win.img.gz.

 # end

Oh, the external drive is usually formatted NTFS, mounted with "-t ntfs-3g".

Related Topic