# dd to smaller media?



## dave (Oct 7, 2010)

I have reviewed much documentation, but I still can't figure out.  I have a disk image file that was created with dd(1).  The original disk size was 16GB, but only about 2 GB were actually used.  Is there a way for me to write this image to an 8GB drive?  Thanks in advance!


----------



## aragon (Oct 8, 2010)

Was the disk image file only 2GB, or the amount of used space in the file system only 2GB?


----------



## wblock@ (Oct 8, 2010)

dave said:
			
		

> I have reviewed much documentation, but I still can't figure out.  I have a disk image file that was created with dd(1).  The original disk size was 16GB, but only about 2 GB were actually used.  Is there a way for me to write this image to an 8GB drive?



Not directly, no.  This is one reason dd(1) is a poor backup method.

You can use mdconfig(8) to mount the image file, then dump(8) the filesystems.  Dump files can be restored to different-sized filesystems.

My article on different backup methods: http://www.wonkity.com/~wblock/docs/html/backup.html


----------

