1826325 Members
3515 Online
109692 Solutions
New Discussion

dd command

 
SOLVED
Go to solution
jok llamera
Advisor

dd command

hi fellas,

When I write directly to a character device, does it bypasses buffer cache? if it is, then does it used async device? how?

fig.1 # dd if=/var/adm/sa/sa01 of=/dev//r bs=8192

Another thing, when I write directly to a filesystem using dd command does it use buffer cache or not?

thanks,
joks





Excelence is not an act but a hobby
5 REPLIES 5
Tom Danzig
Honored Contributor

Re: dd command

I believe dd write directly to the device regardless of whether or not you use the block or character device file. I'm not 100% sure though.

FYI, in addition to "fellas", there a quite a few very sharp ladies in this forum!
Sridhar Bhaskarla
Honored Contributor

Re: dd command

Yes. It doesn't bypass the buffer cache. All raw device disk transactions will go directly to the disk subsystem not via buffer cache.

So your dd command will bypass the buffer cache.

Whenver a file system is accessed it goes through buffer cache unless the vxfs option of mincache=direct is specified.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: dd command

sorry.. a small correction in the top like.

Yes. It does bypass the buffer cache...

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: dd command

Hi:

If you write to ANY character device /dev/rdsk/c2t2d0, dev/vg01/rlvol1 there is no buffer cache. If you write to ANY block device /dev/dsk/c2t2d0, /dev/vg01/lvol1 the buffer cache is used. Buffer cache is always used in filesystem writes unless you enable the OnlineJFS vxfs options convosync=direct,mincache=direct which bypass the buffer cache. This applies to any application not just dd.

Clay
If it ain't broke, I can fix that.
Anthony deRito
Respected Contributor

Re: dd command

It is good to use sar -b to analyze cache hit ratios. (Or Glance if you have it) I find these utilities allow you to understand more clearly whats going on with disk I/O. Raw I/O never uses buffer cache... the lower overhead makes it faster. Whenever you shut down a system or run sync manually, all
modified buffers of the buffer cache are flushed (written) out to
disk.

Tony