Skip to content

Command Line usage

nephri edited this page Jun 19, 2020 · 4 revisions
disklist.pl [-i:<class> <entity>]* [-fs:<fstype>]* [-disk:<disktype>]* [-nolabel] [-multi[:<multitype>]* [-o:<otype>] [-c:<columns>]* [-sort:<column>]* [-all] [-long] [-short] [-static] [-smartctl] [-locate[:<duration]] [-h]

version 1.1c @2020 (sebastien.andre.288@gmail.com)
      contributors (github.com/danielewood)

   List information about detected disks from a single command by merging results from multiple standard FreeBSD tools:
            > geom disk list
            > gpart list
            > glabel list
            > geli list
            > gmultipath list
            > zpool status
            > zpool list
            > sas2ircu list
                 > sas2ircu # display
                 > sas2ircu # locate #:#
            > sas3ircu list
                 > sas3ircu # display
                 > sas3ircu # locate #:#
            > smartctl -A <device>

   This program comes with ABSOLUTELY NO WARRANTY.
   This is free software, and you are welcome to redistribute it under certain conditions (cf. GNU Lesser General Public Licence v3)

   Arguments are:

   -i:<class> <entity>
          Filter devices/partitions that match the specified <entity> on the corresponding <class>
          Classes are:
             dev       : Filter on a device name             (example: -i:dev ada0)
             zpool     : Filter on a ZFS pool name           (example: -i:zpool tank)
             part      : Filter on a partition name          (example: -i:part ada0p1)
             gptid     : Filter on a gpt label               (example: -i:gptid gptid/fe38f700-829a-11e7-810a-00074304a2f0)
             serial    : Filter on a Disk Serial number      (example: -i:serial YFJ4G2BD)
             multipath : Filter on a SAS multipath disk name (example: -i:multipath multipath/disk1)
             enclosure : Filter on a SAS enclosure location  (example: -i:enclosure 1#6), you can specify <enclosure> or <enclosure>#<slot>

          This argument can be set multiple times for specifying multiple filters.

          Be careful, evaluation is done using the following logical form :
                     ( device_predicate1 OR device_predicate2 OR ... ) AND ( partition_predicate1 OR partition_predicate2 .... )

                      devices    predicates are : dev, multipath, serial, enclosure
                      partitions predicates are : zpool, part, gptid

   -fs:<fstype>
          Filter devices/partitions that have a partition that match the specified file system type
          FileSystem types are:
             all       : Accept any               partition type and disk not partitioned. (example: -fs:all)
             none      : Accept only              disk not partitioned.                    (example: -fs:none)
             any       : Accept any               partition type.                          (example: -fs:any)
             zfs       : Accept only freebsd-zfs  partition type.                          (example: -fs:zfs)
             swap      : Accept only freebsd-swap partition type.                          (example: -fs:swap)
             boot      : Accept only bios-boot    partition type.                          (example: -fs:boot)
             unknown   : Accept only unknown      partition type.                          (example: -fs:unknown)

          This argument can be set multiples times for specifying a list of fs types.
          By default this command use theses options : -fs:zfs -fs:none

   -disk:<disktype>
          Filter devices/partitions that match the specified disk type
          Disk types are:
             sdd       : Solid State Drive       (example: -disk:ssd)
             hdd       : Spindle Drive           (example: -disk:hdd)
             nvme      : NVME Solid State Drive  (example: -disk:nvme)
             nvram     : NVRAM Drive             (example: -disk:nvram)
             unknown   : Unknown drive type      (example: -disk:unknown)

          This argument can be set multiples times for specifying a list of disk types

   -nolabel
          Restrict output only to devices (disks) without reporting any informations about partitions.
          That allows for example to report on available disks with these options: -nolabel -multi:none -multi:active
          By default, partitioned disk will be reported with partitions details.

   -multi[:<mode>]
          Filter devices/partitions that use SAS multipath and optionaly match the multipath mode (ACTIVE or PASSIVE)
          Multipath modes are:
             none      : The disk device must not use SAS multipath                           (example: -multi:none)
             active    : The disk device must     use SAS multipath and be the ACTIVE  device (example: -multi:active)
             passive   : The disk device must     use SAS multipath and be the PASSIVE device (example: -multi:passive)

          If no Multipath mode is specified, the disk device must use SAS multipath, whatever the mode of the device.
          This argument can be set multiples times

   -o:<otype>
          Output format to use for reporting devices.
          Output formats are:
             col       : Each device is reported in a dedicated row.  Information is padded with whitespaces into columns and columns are separated by 2 whitespaces.
             csv       : Each device is reported in a dedicated row.  Columns are separated by a semi-colon accordingly to CSV format without any padding.
             list      : Each device is reported in   multiple rows.  Each information is presented on a dedicated row using the format "property: value".

         If ommited, the default is -o:col

   -c:<columns>
          Specify a series of columns to report represented by <columns>. Each column has a symbol identifier.
          The order of a symbol identifier determines the order of the column in the report output.
          Columns identifiers are:
             p         : Partition name                    (example: ada0p1)
             P         : Partition type.                   (example: freebsd-zfs)
             l         : Partition label (gptid).          (example: gptid/fe38f700-829a-11e7-810a-00074304a2f0)
             z         : ZFS pool name                     (example: tank)
             Z         : Partition location on the pool    (example: tank/mirror-0)
             M         : ZFS mount point                   (example: /mnt/tank)
             X         : Partition encryption algorithm    (example: AES-XTS)

             d         : device code                       (example: ada0)
             t         : device sectorsize in Bytes        (example: 512)

             D         : Disk Description                  (example: HITACHI HUS72302CLAR2000)
             U         : Disk size in Gb                   (example: 2000)
             T         : Disk type                         (example: SSD)
             S         : Disk Serial Number                (example: YFJ4G2BD)
             R         : Disk Rotational speed             (example: 7200)
             H         : Disk temperature in °C (smartctl) (example: 43°)
             h         : Power on Hours         (smartctl) (example: 2711)

             e         : Controller/Enclosure location     (example: SAS3008(0):1#6)

             m         : SAS Multipath device              (example: multipath/disk1)
             o         : SAS Multipath device mode         (example: ACTIVE or PASSIVE)
             s         : SAS Multipath state               (example: OPTIMAL)

          Columns using "smartctl" will be reported only if the -smartctl switch is used.
          Some of theses attributes are vendor specifics and may be not available (mainly for SAS devices)...

          You can add -short, -long switches for using a column profile + specified columns.
          In this case, the column order is based on the columns from the selected profile followed by the specified columns.
          If a column identifier appears more than once, the column will be reported multiple times.

   -sort:<columns>
          Specify a series of columns to use for sorting devices and partitions.
          The order of the symbol identifier determines the sort order of the column in the output.
          This tools always reports partitions first and unpartitioned disks afterwards.
          Columns related to partitions (like PplzZMX) are unused for sorting devices (but used for sorting partitions).
          By default, the sort is set to zZmodp (if a column is not reported, it is removed from the sort key also)
          Columns identifiers are the same as used for -c:<columns> switch

    -all
          Reports all columns. It's equivalent to -c:pPlzZMdtDUTSRHhemosX

    -long
          Reports on most of the columns and is the default. It's equivalent to -c:plzdDUTSRHemosX
          Can be used in conjunction with -c: switch to add some columns to the -long profile.

    -short
          Reports with a basic number of columns. It's equivalent to -c:pzdDUT
          Can be used in conjunction with -c: switch to add some columns to the -short profile.

    -static
          By default, empty columns are automatically removed from the report.
          This switch prevent any columns to be removed even if they are empties.

    -smartctl
          Allow the use of "smartctl" commands for providing additional disk informations
          Without this switch, columns that need smartctl will be removed from the output.

    -locate[:duration]
          Blink leds for the specified duration in seconds for all reported disks (using sas2 or sas3 controllers)
          The default duration is 10 seconds when no specified.
          For example you can locate a drive by it's serial number:
             disklist.pl -i:serial YFJ4G2BD -locate
    -h
          Print this help.
Clone this wiki locally