Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
International Rescue Committe

 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, 61 guest(s) and 0 member(s) that are online.

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




       sg_map [-a] [-n] [-scd] [-sd] [-sr] [-st] [-x]


       Sometimes it is difficult to determine which SCSI device a
       sg  device  name  (e.g.  /dev/sg0) refers to. This command
       loops through the sg devices and finds  the  corresponding
       SCSI  disk,  cdrom  or tape device name (if any). Scanners
       are an example of SCSI devices that have no alternate SCSI
       device name apart from their sg device name.

       -a     assume  the  sg  devices  have  alphabetical device
              names and loop  through  /dev/sga,  /dev/sgb,  etc.
              Default is numeric scan

       -n     assume the sg devices have numeric device names and
              loop through /dev/sg0, /dev/sg1,  etc.  Default  is
              numeric scan

       -sd    display mappings to SCSI disk device names

       -scd   display  mappings to SCSI cdrom device names of the
              form /dev/scd0, /dev/scd1 etc

       -sr    display mappings to SCSI cdrom device names of  the
              form /dev/sr0, /dev/sr1 etc

       -st    display mappings to SCSI tape device names

       -x     after each active sg device name is displayed there
              are  five  digits:  <host_number>  <bus>  <scsi_id>
              <lun> <scsi_type>

       If  no  options starting with "-s" are given then the map­
       ping to all SCSI disk, cdrom  and  tape  device  names  is

       If the device file system (devfs) is present a line noting
       this is output. The "native" devfs  scsi  hierarchy  makes
       the  relationship  between a sg device name and any corre­
       sponding disk, cdrom or tape device name  easy  to  estab­
       lish.  This  replaces  the  need for this command. However
       many applications will continue to  look  for  Linux  SCSI
       device  names in their traditional places. [Devfs supplies
       a compatibility daemon called devfsd whose default config­
       uration  adds  back the Linux device names in their tradi­
       tional positions.

       Quite often the mapping  information  can  be  derived  by
       observing    the    output    of    the    command:   "cat
       /proc/scsi/scsi".  However  if  devices  have  been  added
          /dev/sg0  /dev/sda

       The "-x" option gives the following output:
          sg_map -x
          # Note: the devfs pseudo file system is present
          /dev/sg0  1 0 1 0  0  /dev/sda
          /dev/sg1  2 0 4 0  5  /dev/sr0
          /dev/sg2  2 0 6 0  5  /dev/sr1

       When a SCSI scanner is added the output becomes:
          $ sg_map
          # Note: the devfs pseudo file system is present
          /dev/sg0  /dev/sda
          /dev/sg1  /dev/sr0
          /dev/sg2  /dev/sr1

       By process of elimination /dev/sg3 must be the scanner.


       Written by Doug Gilbert


       Report bugs to <dgilbert@interlog.com>.


       Copyright © 2000, 2001 Douglas Gilbert
       This software is distributed  under  the  GPL  version  2.
       There is NO warranty; not even for MERCHANTABILITY or FIT­


       scsi_info(8) , scsidev(8) , devfsd(8)

sg3_utils-0.92             January 2001                 SG_MAP(8)

More information about the site can be found in the FAQ



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.


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