# How to move FreeBSD to a different disk



## balanga (Jun 11, 2016)

I have a FreeBSD installation on a hard disk and it only uses 10% of the disk and I could fit it on a 16GB pendrive. How would I go about transfering it?


----------



## Phishfry (Jun 12, 2016)

Here is a script used to copy an ARM installation from sd card to emmc. It might give you some hints what is required.
There are many ways of doing this. I like this method so far. Compress with tar your live system and extract to your target's prepared disk.


----------



## Phishfry (Jun 12, 2016)

Here is dump and restore from the FAQ:
https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/book.html#idp61619536


----------



## max21 (Jun 12, 2016)

balanga said:


> I have a FreeBSD installation on a hard disk and it only uses 10% of the disk and I could fit it on a 16GB pendrive. How would I go about transfering it?



... or you can even use a live FreeBSD or Linux CD


```
dd if=/dev/ada0 of=/dev/ada1 bs=1024b
```

ada0 is the same machine you put the CD in:
ada1 is where ada0 will be copied to.  if its a flash check /dev/ for type da0

use bs=1024b anything larger will be the same speed.

If you replace the ada0 with the word zero you will wipe ada1 super-clean.  This could make the hard drive last for another 15 years.

dd(1) is is slow but flawless as long as the user don't cross it up.
It takes a little over an hour and a half for 1TB HDD.

dump(8) is much quicker and it provides the finest of defragmentation ever.

First, I dump, than I save it as my most precious backup.  You can figure the rest from there.


----------



## wblock@ (Jun 15, 2016)

Set up the USB stick with partitions that are large enough and bootcode: http://www.wonkity.com/~wblock/docs/html/disksetup.html

Transfer the data using dump(8) and restore(8): http://www.wonkity.com/~wblock/docs/html/backup.html

The Backup article explains why dd(1) is not good for this, and offers options on speeding it up for those who insist on using it anyway.


----------



## max21 (Jun 16, 2016)

Partition Magic and Partition Commander were the real dd(1) tools.  I agree with wblock@, so I’m taking back my recommendation of using FreeBSD.  It works for certain things but not all.  You must learn where it works when FreeBSD is live.  Since the death of Partition Magic all we have now is cfdisk and it don't care what you `dd`.  Even if a datacenter say it’s my fault, I’ll know better.


----------

