{
    "mode": "man",
    "parameter": "sg_scan",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sg_scan/8/json",
    "generated": "2026-06-16T00:47:23Z",
    "synopsis": "sgscan [-a] [-i] [-n] [-w] [-x] [DEVICE]*",
    "sections": {
        "NAME": {
            "content": "sgscan - scans sg devices (or SCSI/ATAPI/ATA devices) and prints results\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sgscan [-a] [-i] [-n] [-w] [-x] [DEVICE]*\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "If no DEVICE names are given, sgscan does a scan of the sg devices and outputs a line of in‐\nformation for each sg device that is currently bound to a SCSI device. If one or more DEVICEs\nare  given only those devices are scanned.  Each device is opened with the ONONBLOCK flag so\nthat the scan will not \"hang\" on any device that another process holds an OEXCL lock on.\n\nAny given DEVICE name is expected to comply with (to some extent)  the  Storage  Architecture\nModel (SAM see www.t10.org).  Any device names associated with the Linux SCSI subsystem (e.g.\n/dev/sda and /dev/st0m) are suitable. Devices names associated with ATAPI devices (e.g.  most\nCD/DVD drives and ATAPI tape drives) are also suitable.  If the device does not fall into the\nabove categories then an ATA IDENTIFY command is tried.\n\nIn Linux 2.6 and 3 series kernels, the lsscsi utility may be helpful.  Apart  from  providing\nmore information (by data-mining in the sysfs pseudo file system), it does not need root per‐\nmissions to execute, as this utility would typically need.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-a",
                    "content": "ical index have been deprecated since the Linux kernel 2.2 series.\n",
                    "flag": "-a"
                },
                {
                    "name": "-i",
                    "content": "disk then output information from an ATA IDENTIFY command\n",
                    "flag": "-i"
                },
                {
                    "name": "-n",
                    "content": "",
                    "flag": "-n"
                },
                {
                    "name": "-w",
                    "content": "",
                    "flag": "-w"
                },
                {
                    "name": "-x",
                    "content": "",
                    "flag": "-x"
                }
            ]
        },
        "NOTES": {
            "content": "This utility was written at a time when hotplugging of SCSI  devices  was  not  supported  in\nLinux.  It used a simple algorithm to scan sg device nodes in ascending numeric or alphabeti‐\ncal order, stopping after there were 4 consecutive errors.\n\nIn the Linux kernel 2.6 series, this utility uses sysfs to find which sg device nodes are ac‐\ntive  and  only  checks those. Hence there can be large \"holes\" in the numbering of sg device\nnodes (e.g. after an adapter has been removed) and still all active sg device nodes  will  be\nlisted.  This utility assumes that sg device nodes are named using the normal conventions and\nsearches from /dev/sg0 to /dev/sg4095 inclusive.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "The exit status of sgscan is 0 when it is successful. Otherwise  see  the  sg3utils(8)  man\npage.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Written by D. Gilbert and F. Jansen\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright © 1999-2013 Douglas Gilbert\nThis software is distributed under the GPL version 2. There is NO warranty; not even for MER‐\nCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "",
            "subsections": [
                {
                    "name": "lsscsi(8)",
                    "content": "sg3utils-1.36                                May 2013                                    SGSCAN(8)"
                }
            ]
        }
    },
    "summary": "sgscan - scans sg devices (or SCSI/ATAPI/ATA devices) and prints results",
    "flags": [
        {
            "flag": "-a",
            "long": null,
            "arg": null,
            "description": "ical index have been deprecated since the Linux kernel 2.2 series."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "disk then output information from an ATA IDENTIFY command"
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-w",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "examples": [],
    "see_also": []
}