# Disk image and dd?



## fredvs (Aug 10, 2015)

Hello.
I have a disk image (.img) of a FreeBSD system.
How can I transfer that disk-image to a hard disk?

In doc I find => "use `dd` to transfer the disk-image".

OK, but how to do and what is the syntax?

The hard disk was already formatted (with boot sector) and wait for transfer...

Thanks.


----------



## wblock@ (Aug 10, 2015)

As far as I know, any of our documentation that suggests using dd(1) shows how to do it.

A disk image is a copy of the entire disk, so there is no point in formatting the target disk beforehand.  Avoid using dd(1) to write to directly to SSDs, because every block written will be considered in use by the SSD, and TRIM will not clear them.  Because disk image files contain lots of empty, unused space, this is a problem.

Example: the image file is example.img and the destination disk is /dev/ada9:
`# dd if=example.img of=/dev/ada9 bs=128k`


----------



## fredvs (Aug 11, 2015)

Many thanks wblock@.

It works! (but not like i want, because the partition-size of the hard disk keep the same size of the image.)

I will create a new topic explaining what I want.

Fre;D


----------



## wblock@ (Aug 11, 2015)

dd(1) is the wrong tool for copying filesystems.  See Backup Options for FreeBSD.  The last sections talk about dd(1) and other programs.


----------

