Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

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):


 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".

share|improve this answer

Yeah, I'm pretty sure it exists. CloneZilla uses dd, and only saves the used sectors. Have a read through the forums there and you should find mention of it. Otherwise download and read the code for their scripts.

share|improve this answer
Clonezilla is the basis for the images we do. Free, easy, and effective, hard to complain about that combination! I keep a master image and then load a machine specific main partition image on a 2nd partition for our laptops in the field. I send out a flash drive with clonezilla on it and our engineers can wipe their systems on demand. If they lose the flash drive, it's easy enough for an engineer to get clonezilla remotely as opposed to commercial restore utils. – DHayes Jul 28 '09 at 13:44

you can check partimage as well.

share|improve this answer

Drive Image from PDQ used to be able to "understand" the filesystem and therefore it only needed to store the used bytes, even if the rest where not zero. Given that it was bought by another company and changed into Ghost. The following table from wikipedia shows a large number of system which do "Smart Copying" for a number of different file systems.

share|improve this answer

You should not create an image from the drive but make backup of the filesystem. With dump for example. It will copy only the blocks used in the filesystem. dd doesn't know anything about 'used' and 'free' blocks.

share|improve this answer

I'm not sure that you want an imaging program like dd(1) as much as tar(1) and a compression utility of your choice. Can you give us a bit more detail about what you're actually trying to do?

share|improve this answer
Simply image a drive with a fresh install of any chosen os. I know I could easily use tar or many other tools. Im more interested in using dd, and if such a option doesn't already exist id like to make it. – Recursion Jul 28 '09 at 4:59

Basically, you want a tool that understands the filesystem and only saves blocks that are used. This is a good thing, but I kind of like having a full image of the drive (because I'm paranoid). In order to do that, and minimize the space needed for a compressed image, I use (on Windows systems that I want to image) the SysInternals 'sdelete' to write zeros to the unused sectors. That way the image is as compressible as it's going to get while still being a bit image.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.