create image from hard disk without free space (linux)

I want to create image from hard disk without free space (useless space) in linux(ex3 type).

I've been tried to create image with dd command but this command gave us total size of hard disk.

I need data on this hard disk without free space.

thanks a lot.


Sounds like Partimage might be what you are looking for?


One option would be to create the file system image as a sparse file. You could first run an utility such as zerofree on your ext3 file system to make sure all free blocks are filled with zeros, and then just image the disk with dd and pipe the image through cp with the --sparse=always option to force it to create a sparse file:

dd if=/dev/whatever | cp --sparse=always /dev/stdin disk.image

If you're using LVM, clonezilla is the way to go.