Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Let The Music Play: Join EFF Today

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 74 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

sg_read



SYNOPSIS

       sg_read [OPTION]...


DESCRIPTION

       Read data from a Linux SCSI generic  (sg)  device,  a  raw
       devices  or a normal file with each read command issued to
       the same offset. This will test  (or  time)  disk  caching
       and/or SCSI (or some other) bus throughput.

       bpt=BLOCKS
              each  read operation will be made using this number
              of blocks (or less  if  near  the  end  of  count).
              Default  is 128. Note also that each read operation
              starts at the same offset (as given by skip or  0).

       bs=BYTES
              this  must be the block size of the physical device
              (defaults to 512)

       cdbsz=6 | 10 | 12 | 16
              size of SCSI READ  commands  issued  on  sg  device
              names.  Default is 10 byte SCSI READ command blocks

       count=BLOCKS
              read this number of blocks. This argument  must  be
              given

       dio=0 | 1
              default  is 0 which selects indirect IO. Value of 1
              attempts direct IO which, if not  available,  falls
              back  to  indirect IO and notes this at completion.
              If     direct     IO      is      selected      and
              /proc/scsi/sg/allow_dio  has  the value of 0 then a
              warning is issued (and indirect IO is performed)

       if=FILE
              read from this FILE. This argument must be given

       mmap= 0 | 1
              default is 0 which selects indirect IO. Value of  1
              causes  memory mapped IO to be performed. Selecting
              both dio and mmap is an error

       skip=BLOCKS
              all read operations will start offset by BLOCKS bs-
              sized  blocks  from  the  start  of  input (file or
              device)

       time=0 | 1 | 2
              When 0 (default) doesn't perform timing.   when  1,
              times  transfer  and  does  throughput calculation,
              starting at the first issued command until  comple­

       Data  usually gets to the user space in a 2 stage process:
       first the SCSI adapter DMAs into kernel buffers  and  then
       the  sg driver copies this data into user memory.  This is
       called "indirect IO" and there is a "dio" option to select
       "direct  IO" which will DMA directly into user memory. Due
       to some issues "direct IO" is disabled in  the  sg  driver
       and  needs  a configuration change to activate it. This is
       typically done with "echo 1 > /proc/scsi/sg/allow_dio". An
       alternate  way to avoid the 2 stage copy is to select mem­
       ory mapped IO.


EXAMPLES

       Let us assume that /dev/sg0 is a disk and we wish to  time
       the disk's cache performance.

          sg_read if=/dev/sg0 bs=512 count=1M mmap=1 time=2

       This  command  will  continually  read 128 512 byte blocks
       from block 0.  The "128" is the default  value  for  "bpt"
       while  "block 0" is chosen because the "skip" argument was
       not given. This will continue until 1,000,000  blocks  are
       read.  The idea behind using "time=2" is that the first 64
       KB read operation will involve reading the magnetic  media
       while  the remaining read operations will "hit" the disk's
       cache. The output of thid command will look like this:

         time from second command to end  was  8.51  secs,  60.19
       MB/sec
         1000000+0 records in, SCSI commands issued: 7813


AUTHORS

       Written by Doug Gilbert.


REPORTING BUGS

       Report bugs to <dgilbert@interlog.com>.


COPYRIGHT

       Copyright © 2000-2002 Douglas Gilbert
       This  software  is  distributed  under  the GPL version 2.
       There is NO warranty; not even for MERCHANTABILITY or FIT­
       NESS FOR A PARTICULAR PURPOSE.


SEE ALSO

       To time streaming media read or write time see sg_dd is in
       the sg3_utils package. The lmbench package  contains  lmdd
       which is also interesting.  raw(8), dd(1)

sg3_utils-0.98            February 2002                SG_READ(8)
  

Looking for a "printer friendly" version?


Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can help in many different ways.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.11 Seconds