# dd command



## mmy (Oct 21, 2009)

Hi
i need to write file on middle of device with dd command.
in linux , i do this :

```
dd if=/tmp/abc of=/dev/da0 bs=10
```
but in freebsd 7.2 give this error :

```
dd: /dev/da0: Invalid argument
```


----------



## Beastie (Oct 21, 2009)

bs is the block size. Use a multiple of 512 (512 bytes usually being the smallest physical sector size), e.g. 8192, 24m, etc. Or just remove the bs parameter altogether to use the default.


----------



## SirDice (Oct 21, 2009)

mmy said:
			
		

> My way on Linux work , but i can't do on freebsd 7.2
> Please help .



See dd(1)


----------



## graudeejs (Oct 21, 2009)

set *bs* to *512*


----------



## SirDice (Oct 21, 2009)

Try iseek instead of skip.


----------



## chavez243ca (Oct 21, 2009)

how about the output from dmesg|grep da

(or mount or df -h...)

to see if such a device exists


----------



## aragon (Oct 21, 2009)

And if it does exist, make sure nothing is mounted from it or disable geom's anti-foot-shooting feature:


```
sysctl kern.geom.debugflags=16
```


----------



## gordon@ (Oct 21, 2009)

When working with a block device (which /dev/da0 is), you need to use blocks. Disk blocks are 512 bytes (which is why everyone is telling you to set bs=512)


----------



## Beastie (Oct 21, 2009)

mmy said:
			
		

> ```
> dd if=a of=/dev/da0 skip=10 count=18
> 0+0 records in
> 0+0 records out
> ...


Try switching if<=>of (`% dd of=a if=/dev/da0 skip=10 count=18`). Does it read da0 and create a 9KB file called "a" or not?




			
				chavez243ca said:
			
		

> to see if such a device exists


If the device didn't exist he should get

```
dd: /dev/da0: No such file or directory
```


----------



## Beastie (Oct 22, 2009)

mmy said:
			
		

> Thanks for replies


Sure! But are you reading any? Doesn't seem so...



			
				mmy said:
			
		

> I do in Linux without problem ,
> 
> ```
> dd if=abc of=/dev/[u]sdb[/u] bs=10 seek=13
> ...


Definitely not. FreeBSD doesn't have any sdb device.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-naming.html


----------



## chavez243ca (Oct 23, 2009)

hmmm... it's possible that a linux /dev/sdb translates into a BSD /dev/da1

check your devices


----------



## chavez243ca (Oct 23, 2009)

actually... come to think of it, I think I've also seen some SATA drives end up as /dev/adX instead of /dev/daX


----------



## SirDice (Oct 23, 2009)

chavez243ca said:
			
		

> actually... come to think of it, I think I've also seen some SATA drives end up as /dev/adX instead of /dev/daX



Normally SATA drives are ad4 and higher. You could get daX if you have atapicam installed.


----------



## mmy (Oct 24, 2009)

Thanks a lot .
Now i can use freeBSD instead linux without any worry .
because freeBSD have great community


----------

