Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
The ONE Campaign to make poverty history

 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

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

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

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




       sgdiag [-aenx]


       Sgdiag  is  a program that uses the SCSI Generic interface
       to send specific SCSI commands to specified SCSI  devices.
       The  SCSI Generic interface requires that the kernel .con­
       fig file have CONFIG_CHR_DEV_SG set.

       A log file, named sgdiag.log is created  in  the  /var/log
       directory  which  logs the status of the functions and any

       Several different functions can  be  performed  with  this

       c = Compose Command to send
              This  function  allows the user to compose a custom
              SCSI command to send to one or  more  devices.   It
              prompts  the user for the command length, each com­
              mand byte, the write data length, each  write  data
              byte, and the receive data length.

       r = Reset SCSI bus
              This  function  will send a bus reset signal to the
              SCSI bus of the selected device.  This may be  use­
              ful to free up a hung device.

       i = Special Ser# Inquiries
              This  issues several special SCSI inquiry to obtain
              the serial number of the device.  Normally this  is
              not  needed, since the serial number of most modern
              devices is included in the standard inquiry.

       f = Format SCSI disk
              This function issues a low-level SCSI  format  com­
              mand  to  the selected device.  This will remap any
              media defects as it formats the disk.   Of  course,
              it will erase any data on the selected disk.

       w = Wipe SCSI disk
              This  function  issues a low-level SCSI format com­
              mand to the selected device.  This will NOT include
              the previous grown defect list.  This may be useful
              in testing to cause a disk  to  expose  some  media
              defects.   This is dangerous and should not be used
              on production systems.

       d = Send Diagnostic self-test
              This function issues a SCSI Send  Diagnostic  self-
              test  command  to  the selected device.  The device

       1 = Do bug 1 (sense_len = 18)
              The standard sg structure only defines 16 bytes  of
              sense  data,  whereas  18 bytes are needed to parse
              some illegal request  sense  keys.   This  function
              attempts to request 18 bytes of sense data from the
              standard sg structure, which should cause a 5/24/00
              sense error, but should not cause the driver or the
              utility to hang or stop working.

       2 = Do bug 2 (INQ hang)
              In versions of the old  adaptec  driver  that  were
              delivered  with RedHat 6.2, this function will hang
              the driver by requesting a receive buffer less than
              96 bytes.  Newer versions of the driver should han­
              dle this function without error (status = 0).

       3 = Do bug 3 (format w short timeout)
              A SCSI format command can take several  minutes  to
              complete.  If the SCSI timeout is set too short, it
              should cause several retries, followed  by  marking
              the  SCSI device offline.  The device should return
              to normal after a reboot.


       Command line options are described below.

       -?     This option displays  a  summary  of  the  commands
              accepted by sgdiag

       -a     Automatically  send  command  for  all devices.  If
              this option is specified, a  default  illegal  SCSI
              LOG_SENSE command will be sent to each device.

       -e     Causes  any  file writes to be avoided, such as the
              log file.

       -n     Naming.  By default, the device names are displayed
              as numeric sequences (/dev/sg0).  This option shows
              the   device   names   as   alphabetic    sequences

       -x     Causes extra debug messages to be displayed.


       sgdefects(8) sgdskfl(8) sgmode(8)


       sgdiag is distributed in the hope that it will be  useful,


       Andy Cress <arcress@users.sourceforge.net>

                     Version 1.4: 14 May 2002           SGDIAG(8)



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 choose larger fonts by selecting a different themes.


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.09 Seconds