# Preparing USB drive



## Graaf_van_Vlaanderen (Jan 10, 2010)

On a couple of occasions I installed from a USB-device:
To create the install USB drive I use this command (like noted in the handbook):


```
dd if=*.img of=/dev/d** bs=10240 conv=sync
```

This works fine with a 'fresh' USB stick, however when I want to do this a second time over the same USB stick, boot fails.

How can I properly clear the USB stick before issuing the above mentioned command?


----------



## multibyte (Jan 10, 2010)

> How can I properly clear the USB stick before issuing the above mentioned command?


You could "newfs(8)" the usb drive.


----------



## J65nko (Jan 10, 2010)

```
dd if=/dev/zero of=/dev/d** bs=64k
```


----------



## Graaf_van_Vlaanderen (Jan 10, 2010)

J65nko said:
			
		

> ```
> dd if=/dev/zero of=/dev/d** bs=64k
> ```



I received the following message:


```
Hjordis# dd if=/dev/zero of=/dev/da2 bs=64k
dd: /dev/da2: Device not configured
25244+0 records in
25243+0 records out
1654325248 bytes transferred in 193.809402 secs (8535836 bytes/sec)
```

I got a similar message while creating the image that didn't boot in the end. I didn't see this error with the other stick. I still have to try this stick after this erase.


----------



## Graaf_van_Vlaanderen (Jan 10, 2010)

multibyte said:
			
		

> You could "newfs(8)" the usb drive.



Received this feedback:


```
Hjordis# newfs /dev/da2
/dev/da2: 1938.0MB (3969024 sectors) block size 16384, fragment size 2048
        using 11 cylinder groups of 183.72MB, 11758 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
 160, 376416, 752672, 1128928, 1505184, 1881440, 2257696, 2633952, 3010208, 3386464, 3762720
```


----------



## Graaf_van_Vlaanderen (Jan 10, 2010)

I did both and it seems to work now, since I can boot again the same USB-stick.


----------

