2004-06-02 12:08:10

by Piszcz, Justin Michael

[permalink] [raw]
Subject: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

root@jpiszcz:~# mkdir /p500/dev
root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
root@jpiszcz:~# echo blah > /p500/dev/null
root@jpiszcz:~# ls -l /p500/dev/null
crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null

6179737+0 records in
6179736+0 records out

Instead it treats it as a local block device?

Kernel 2.6.5.



2004-06-02 12:14:12

by Christoph Hellwig

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

On Wed, Jun 02, 2004 at 08:04:06AM -0400, Piszcz, Justin Michael wrote:
> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?

character device actually. Anyway, nfs never forwarded device files, the
protocol can't handle all the ioctl() variants anyway.

and how else would root on nfs work? :)

2004-06-02 12:21:05

by Grzegorz Kulewski

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

Hi,

As far as I understand devices in Linux, device file is only some kind of
note to the *local* kernel that operations on that file is to be
redirected to the device. It is always resolved by the local kernel and
redirected to the local device (if tere is driver that claims this
major/minor number). Life would be to simple...


Grzegorz Kulewski


On Wed, 2 Jun 2004, Piszcz, Justin Michael wrote:

> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?
>
> Kernel 2.6.5.

2004-06-02 12:22:03

by Måns Rullgård

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

"Piszcz, Justin Michael" <[email protected]> writes:

> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?
>
> Kernel 2.6.5.

That is how it's supposed to work. Think about root on nfs.

--
M?ns Rullg?rd
[email protected]

2004-06-02 12:28:20

by Piszcz, Justin Michael

[permalink] [raw]
Subject: RE: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

Thanks, I was thinking since /dev/null isn't a ``device'' like a hard drive is; I thought this would work but I now see why it doesn't, thanks.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of M?ns Rullg?rd
Sent: Wednesday, June 02, 2004 8:20 AM
To: [email protected]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

"Piszcz, Justin Michael" <[email protected]> writes:

> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?
>
> Kernel 2.6.5.

That is how it's supposed to work. Think about root on nfs.

--
M?ns Rullg?rd
[email protected]

2004-06-02 12:39:29

by Richard B. Johnson

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

On Wed, 2 Jun 2004, Piszcz, Justin Michael wrote:

> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?
>
> Kernel 2.6.5.
>

First, /dev/null is a device file. Can you access a remote
device over nfs? ... like

mount chaos:/dev/ttyS0 /mnt
cat "foo" >/mnt

I think not. Yes it's the exact same thing; /dev/null is a
character device just like /dev/ttyS0, but a bit dumber.
The above used the network to make the essential equivalent
of a sym-link. The open of the device-file, the connection
of the major-minor numbers to the resulting file descriptor
occurred on your local system.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.


2004-06-02 20:37:35

by Horst H. von Brand

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

"Piszcz, Justin Michael" <[email protected]> said:

[...]

> Instead it treats it as a local block device?

Because only the _description_ (inode for device, etc) for /nfs/dev/null
are gotten over the net, the actual _device_ is local.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513

2004-06-02 20:45:38

by Arthur Perry

[permalink] [raw]
Subject: Re: How come dd if=/dev/zero of=/nfs/dev/null does not send packets over the network?

If your goal is to simply push the network (and here I am assuming you are
just using nfs for that reason simply because it seemed easy to set up and
do), and using nfs to create an actual file on disk on the other side
isn't going to be fast enough, try using netcat instead.. no nfs.

You can have netcat listen on a socket at the receiving end and redirect
to /dev/null. It is initiated on the recieving end, thus /dev/null will be
referenced by that machine.
You then can connect to it on the sending end with netcat and source from
your /dev/zero.

I used to do this, and use 'time' to determine how long it took to move xx
bytes.
It's a quick and dirty really.. But works well for rough approximations.

Arthur Perry
Lead Linux Developer / Linux Systems Architect
Validation, CSU Celestica
Sair/Linux Gnu Certified Professional
Providing professional Linux solutions for 7+ years



On Wed, 2 Jun 2004, Piszcz, Justin Michael wrote:

> root@jpiszcz:~# mkdir /p500/dev
> root@jpiszcz:~# mount 192.168.0.253:/dev /p500/dev
> root@jpiszcz:~# echo blah > /p500/dev/null
> root@jpiszcz:~# ls -l /p500/dev/null
> crw-rw-rw- 1 root sys 1, 3 Jul 17 1994 /p500/dev/null
> root@jpiszcz:~# dd if=/dev/zero of=/p500/dev/null
>
> 6179737+0 records in
> 6179736+0 records out
>
> Instead it treats it as a local block device?
>
> Kernel 2.6.5.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>