{"id":13585568,"url":"https://github.com/stanford-rc/sasutils","last_synced_at":"2025-09-26T18:51:25.302Z","repository":{"id":10935522,"uuid":"67557226","full_name":"stanford-rc/sasutils","owner":"stanford-rc","description":"Serial Attached SCSI (SAS) Linux utilities and Python library","archived":false,"fork":false,"pushed_at":"2024-11-12T01:00:16.000Z","size":248,"stargazers_count":67,"open_issues_count":10,"forks_count":18,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-05T22:08:10.634Z","etag":null,"topics":["linux","sas","scsi","storage","sysfs","system","tool","udev-rules"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stanford-rc.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-07T00:29:04.000Z","updated_at":"2025-01-30T16:58:42.000Z","dependencies_parsed_at":"2023-02-15T11:15:28.167Z","dependency_job_id":"53b8ec42-67e5-47ad-83d7-fabda73088d6","html_url":"https://github.com/stanford-rc/sasutils","commit_stats":{"total_commits":132,"total_committers":7,"mean_commits":"18.857142857142858","dds":"0.045454545454545414","last_synced_commit":"ad5b45c8646273c897c620d59b2cab9f995b3c37"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanford-rc%2Fsasutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanford-rc%2Fsasutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanford-rc%2Fsasutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanford-rc%2Fsasutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stanford-rc","download_url":"https://codeload.github.com/stanford-rc/sasutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247636190,"owners_count":20970878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","sas","scsi","storage","sysfs","system","tool","udev-rules"],"created_at":"2024-08-01T15:05:01.110Z","updated_at":"2025-09-26T18:51:20.268Z","avatar_url":"https://github.com/stanford-rc.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"sasutils is a set of command-line tools and a Python library to ease the administration of Serial Attached SCSI (SAS) storage networks.\n\n.. image:: https://img.shields.io/pypi/v/sasutils.svg\n    :target: https://pypi.python.org/pypi/sasutils/\n\n.. image:: https://img.shields.io/pypi/pyversions/sasutils.svg\n    :target: https://pypi.python.org/pypi/sasutils/\n    :alt: Supported Python Versions\n\n.. image:: https://img.shields.io/pypi/l/sasutils.svg\n    :target: https://pypi.python.org/pypi/sasutils/\n    :alt: License\n\nsasutils command-line tools\n===========================\n\n* sas_counters\n* sas_devices\n* sas_discover\n* ses_report\n\nAlso, a few \"zeroconf\" udev scripts for use in udev rules that create friendly device aliases using SES-2 subenclosure nicknames.\n\n* sas_mpath_snic_alias\n* sas_sd_snic_alias\n* sas_st_snic_alias\n\n.. note::\n\n       While **sasutils** gets most of the system data from sysfs (/sys), `sg_ses` (available in sg3_utils or sg3-utils)\n       and `smp_discover` (available in smp_utils or smp-utils) are required for some SES features to work.\n\n.. warning::\n\n       **sasutils** is known to be broken with the new SAS 24Gb/s Broadcom driver mpi3mr. This driver is currently not\n       creating sas objects (sas_host, etc.) in sysfs, which are used by sasutils. Suggestions are welcome.\n\n\nsas_counters\n------------\n\n**sas_counters** reports SAS/SES/SD I/O and phy error counters and provides SAS topology information in an output suitable for Carbon/Graphite.\nThis command also supports SES-2 nicknames as seen in the example below (``io1-sassw1`` is the nickname of a SAS switch and ``io1-jbod1-0`` is the nickname of a JBOD SIM).\n\n    .. code-block::\n\n        $ sas_counters\n        ...\n        oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.ioerr_cnt 2 1487457378\n        oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.iodone_cnt 7154904 1487457378\n        oak-io1-s1.SAS9300-8e.0x500605b00ab01234.Switch184.io1-sassw1.JB4602_SIM_0.io1-jbod1-0.bays.41.ST8000NM0075.0x5000c50084c79876.iorequest_cnt 7154906 1487457378\n        ...\n        oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.invalid_dword_count 5 1487457378\n        oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.loss_of_dword_sync_count 1 1487457378\n        oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.phy_reset_problem_count 0 1487457378\n        oak-io1-s1.SAS9300-8e.0x500605b00ab05678.Switch184.io1-sassw2.phys.15.running_disparity_error_count 1 1487457378\n        ...\n\n\nsas_discover\n------------\n\nDisplay SAS topology. By default, **sas_discover** tries to fold common devices (like disks). Use ``-v``, ``-vv`` or ``-vvv`` and ``--addr`` to display more details.\nBelow is an example with a large topology with multiple SAS HBAs, SAS switches and SAS JBODs.\n\n    .. code-block::\n\n        $ sas_discover -v\n        oak-io8-s2\n        |--host1 HBA 9500-16e\n        |  `--8x--expander-1:0 ASTEK \n        |         |--1x--end_device-1:0:0\n        |         |      `--enclosure io8-sassw2 ASTEK \n        |         |--4x--expander-1:1 HGST \n        |         |      |--1x--end_device-1:1:0\n        |         |      |      `--enclosure io8-jbod1 HGST \n        |         |      |--10x--expander-1:9 HGST \n        |         |      |  `-- 50 x end_device -- disk\n        |         |      `--10x--expander-1:10 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:2 HGST \n        |         |      |--1x--end_device-1:2:0\n        |         |      |      `--enclosure io8-jbod2 HGST \n        |         |      |--10x--expander-1:11 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:12 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:3 HGST \n        |         |      |--1x--end_device-1:3:0\n        |         |      |      `--enclosure io8-jbod3 HGST \n        |         |      |--10x--expander-1:13 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:14 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:4 HGST \n        |         |      |--1x--end_device-1:4:0\n        |         |      |      `--enclosure io8-jbod4 HGST \n        |         |      |--10x--expander-1:15 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:16 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:5 HGST \n        |         |      |--1x--end_device-1:5:0\n        |         |      |      `--enclosure io8-jbod5 HGST \n        |         |      |--10x--expander-1:17 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:18 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:6 HGST \n        |         |      |--1x--end_device-1:6:0\n        |         |      |      `--enclosure io8-jbod6 HGST \n        |         |      |--10x--expander-1:19 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:20 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         |--4x--expander-1:7 HGST \n        |         |      |--1x--end_device-1:7:0\n        |         |      |      `--enclosure io8-jbod7 HGST \n        |         |      |--10x--expander-1:21 HGST \n        |         |      |  `-- 51 x end_device -- disk\n        |         |      `--10x--expander-1:22 HGST \n        |         |         `-- 51 x end_device -- disk\n        |         `--4x--expander-1:8 HGST \n        |                |--1x--end_device-1:8:0\n        |                |      `--enclosure io8-jbod8 HGST \n        |                |--10x--expander-1:23 HGST \n        |                |  `-- 51 x end_device -- disk\n        |                `--10x--expander-1:24 HGST \n        |                   `-- 51 x end_device -- disk\n        `--host10 HBA 9500-16e\n           `--8x--expander-10:0 ASTEK \n                  |--1x--end_device-10:0:0\n                  |      `--enclosure io8-sassw1 ASTEK \n                  |--4x--expander-10:1 HGST \n                  |      |--1x--end_device-10:1:0\n                  |      |      `--enclosure io8-jbod1 HGST \n                  |      |--10x--expander-10:9 HGST \n                  |      |  `-- 50 x end_device -- disk\n                  |      `--10x--expander-10:10 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:2 HGST \n                  |      |--1x--end_device-10:2:0\n                  |      |      `--enclosure io8-jbod2 HGST \n                  |      |--10x--expander-10:11 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:12 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:3 HGST \n                  |      |--1x--end_device-10:3:0\n                  |      |      `--enclosure io8-jbod3 HGST \n                  |      |--10x--expander-10:13 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:14 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:4 HGST \n                  |      |--1x--end_device-10:4:0\n                  |      |      `--enclosure io8-jbod4 HGST \n                  |      |--10x--expander-10:15 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:16 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:5 HGST \n                  |      |--1x--end_device-10:5:0\n                  |      |      `--enclosure io8-jbod5 HGST \n                  |      |--10x--expander-10:17 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:18 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:6 HGST \n                  |      |--1x--end_device-10:6:0\n                  |      |      `--enclosure io8-jbod6 HGST \n                  |      |--10x--expander-10:19 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:20 HGST \n                  |         `-- 51 x end_device -- disk\n                  |--4x--expander-10:7 HGST \n                  |      |--1x--end_device-10:7:0\n                  |      |      `--enclosure io8-jbod7 HGST \n                  |      |--10x--expander-10:21 HGST \n                  |      |  `-- 51 x end_device -- disk\n                  |      `--10x--expander-10:22 HGST \n                  |         `-- 51 x end_device -- disk\n                  `--4x--expander-10:8 HGST \n                         |--1x--end_device-10:8:0\n                         |      `--enclosure io8-jbod8 HGST \n                         |--10x--expander-10:23 HGST \n                         |  `-- 51 x end_device -- disk\n                         `--10x--expander-10:24 HGST \n                            `-- 51 x end_device -- disk\n\n\nUse ``sas_discover --counters`` to display the number of SCSI commands issued (`req`), completed or rejected (`done`) and the ones that completed with an error (`error`).\n\n.. image:: https://raw.githubusercontent.com/stanford-rc/sasutils/master/doc/examples/sas_discover_counters_tape.svg\n\n\nsas_devices\n-----------\n\nZeroconf tool that scans SAS devices and resolves associated enclosures. Useful to quickly check cabling and hardware setup.\n\nWhen used with -v, **sas_devices** will also display all disk devices with serial numbers.\n\nThe following example shows a proper detection of a 60-disk JBOD with 2 SIMs/IOMs (an \"enclosure group\").\n\n    .. code-block::\n\n        $ sas_devices\n        Found 2 SAS hosts\n        Found 4 SAS expanders\n        Found 1 enclosure groups\n\t\tEnclosure group: [io1-jbod1-0][io1-jbod1-1]\n\t\tNUM         VENDOR            MODEL    REV     SIZE  PATHS\n\t\t 60 x      SEAGATE     ST8000NM0075   E004    8.0TB      2\n        Total: 60 block devices in enclosure group\n\n\nThe following example shows a proper detection of four Seagate Exos E JBOFs with 15.4TB SSDs. Note that 2 IOMs are detected for each JBOF and they have the same SES-2 nickname (this is normal with this hardware).\n\n    .. code-block::\n\n        $ sas_devices\n        Found 2 SAS hosts\n        Found 8 SAS expanders\n        Found 4 enclosure groups\n        Enclosure group: [io1-jbof4][io1-jbof4]\n        NUM         VENDOR            MODEL    REV     SIZE  PATHS\n         24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2\n        Total: 24 block devices in enclosure group\n        Enclosure group: [io1-jbof2][io1-jbof2]\n        NUM         VENDOR            MODEL    REV     SIZE  PATHS\n         24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2\n        Total: 24 block devices in enclosure group\n        Enclosure group: [io1-jbof3][io1-jbof3]\n        NUM         VENDOR            MODEL    REV     SIZE  PATHS\n         24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2\n        Total: 24 block devices in enclosure group\n        Enclosure group: [io1-jbof1][io1-jbof1]\n        NUM         VENDOR            MODEL    REV     SIZE  PATHS\n         24 x      SEAGATE   XS15360SE70084   0003   15.4TB      2\n        Total: 24 block devices in enclosure group\n\n\nses_report\n----------\n\nSES status and environmental metrics.\n\nUsed with -c, this command will find all enclosures and then use SES-2 nicknames and use sg_ses to output results suitable for Carbon/Graphite.\n\n    .. code-block::\n\n        $ ses_report -c --prefix=datacenter.stanford\n        datacenter.stanford.io1-sassw1.Cooling.Left_Fan.speed_rpm 19560 1476486766\n        datacenter.stanford.io1-sassw1.Cooling.Right_Fan.speed_rpm 19080 1476486766\n        datacenter.stanford.io1-sassw1.Cooling.Center_Fan.speed_rpm 19490 1476486766\n        ...\n\nUse -s to get the status of all detected SES Element Descriptors.\n\n    .. code-block::\n\n        # ses_report -s --prefix=datacenter.stanford | grep SIM\n        datacenter.stanford.io1-jbod1-0.Enclosure_services_controller_electronics.SIM_00 OK\n        datacenter.stanford.io1-jbod1-0.Enclosure_services_controller_electronics.SIM_01 OK\n        datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_SIM_0 OK\n        datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_ISIM_2 OK\n        datacenter.stanford.io1-jbod1-0.SAS_expander.SAS_Expander_ISIM_0 OK\n        datacenter.stanford.io1-jbod1-1.Enclosure_services_controller_electronics.SIM_00 OK\n        datacenter.stanford.io1-jbod1-1.Enclosure_services_controller_electronics.SIM_01 OK\n        datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_SIM_1 OK\n        datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_ISIM_3 OK\n        datacenter.stanford.io1-jbod1-1.SAS_expander.SAS_Expander_ISIM_1 OK\n\n.. warning::\n\n       **ses_report** requires a recent version of *sg3_utils* and won't work with the version shipped with CentOS 6 for example.\n\n\nsas_sd_snic_alias and sas_st_snic_alias\n---------------------------------------\n\nGenerate udev aliases using the SES-2 subenclosure nickname and bay identifier of each device.\nThese scripts can also be used as examples and adapted to your specific needs.\n\nFor example, for block devices, add the following to your udev rules:\n\n    .. code-block::\n\n        KERNEL==\"sd*\", PROGRAM=\"/usr/bin/sas_sd_snic_alias %k\", SYMLINK+=\"%c\"\n\nOr, for SAS tape drives behind SAS switches (that act as enclosures):\n\n    .. code-block::\n\n        KERNEL==\"st*\", PROGRAM=\"/usr/bin/sas_st_snic_alias %k\", SYMLINK+=\"%c\"\n\nThis should generate udev aliases made of the device subenclosure nickname followed by the bay identifier. In the following case, *io1-jbod1-0* is the subenclosure nickname (here SIM 0 of JBOD #1).\n\n    .. code-block::\n\n        $ ls -l /dev/io1-jbod1-0-bay26\n        lrwxrwxrwx 1 root root 4 Oct 14 21:00 /dev/io1-jbod1-0-bay26 -\u003e sdab\n\n.. note::\n\n       Use `sg_ses --nickname=...` to define SES-2 subenclosure nicknames.\n\nsas_mpath_snic_alias\n--------------------\n\nThis utility is very similar to **sas_sd_snic_alias** but only accepts device-mapper devices. Add the following line to your udev rules:\n\n    .. code-block::\n\n        KERNEL==\"dm-[0-9]*\", PROGRAM=\"/usr/bin/sas_mpath_snic_alias %k\", SYMLINK+=\"mapper/%c\"\n\nThis will result in useful symlinks.\n\n    .. code-block::\n\n        $ ls -l /dev/mapper/io1-jbod1-bay26\n        lrwxrwxrwx 1 root root 8 Oct 14 21:00 /dev/mapper/io1-jbod1-bay26 -\u003e ../dm-31\n\n.. note::\n\n       For **sas_mpath_snic_alias** to work with a JBOD having two SIMs, both enclosure nicknames should have a common prefix (eg. \"myjbodX-\") that will be automatically used.\n\n\nsasutils Python library\n=======================\n\nDocumentation will be available on the `wiki`_.\n\n* the following example will list all SAS hosts (controllers) found in sysfs\n\n    .. code-block:: python\n\n        from sasutils.sas import SASHost\n        from sasutils.sysfs import sysfs\n\n        # sysfs is a helper to walk through sysfs (/sys)\n        for node in sysfs.node('class').node('sas_host'):\n\n            # Instantiate SASHost with the sas_host sysfs device class\n            host = SASHost(node.node('device'))\n\n            # To get its sysfs name, use:\n            print(host.name)\n            # To get attributes from scsi_host, use:\n            print('  %s' % host.scsi_host.attrs.host_sas_address)\n            print('  %s' % host.scsi_host.attrs.version_fw)\n\n* See also https://github.com/stanford-rc/sasutils/wiki/Code-snippets\n\n:Author: Stephane Thiell - Stanford Research Computing Center\n\n.. _wiki: https://github.com/stanford-rc/sasutils/wiki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanford-rc%2Fsasutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstanford-rc%2Fsasutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanford-rc%2Fsasutils/lists"}