SHOWDISKS.PL - Summary of disks

Download this program


NAME - Generate summary of disks on a Linux machine

SYNOPSIS -o /tmp/mysumary.txt -html -o /tmp/mysumary.html -id DATA -byslot -html -o /tmp/mysumary.html


Use this program to generate a summary of the disks for a host running Linux. This is particularly of interest when your machine has a large number of drives.

The summary of each drive includes its state (mounted or part of another filesystem like LVM, MD or ZFS), size, serial number etc. If partitions are defined for the drive, a list of these is provided.

The intent of this program is not to replace your others tools to manage partitions, but rather the point here is to provide a means to keep track of a large set of drives and exactly what use is being made of them.

This can be especially helpful if you provide a mapping file of drive serial numbers and slots. Unfortunately, RedHat systems do not have the necessary data available to get serial numbers of the drives. At this time only Debian based systems (including Ubuntu and friends) provide access to the serial number information. While this program will provide some useful information, it really only works on Debian systems.

The motivation for this program came when I first encountered a Sun x4500 which had 48 drives. In particular I wanted to keep track of what drives were being used and where the drive was (i.e. what slot). This turned out to be a particularly clumsy thing to discover. My solution is to provide a map of drive serial numbers and slot numbers, which must be determined manually. Linux has a means to determine the serial number of the drive with software, but there is no reliable way I could determine the slot - hence a manually created map is necessary.

Details about this program are available from and a sample of the HTML output generated by it can be seen at

Note: If you use ZFS, you may need to set the path to zpool in %opts at the top of the program. This script uses sudo to issue certain commands as root.



Specifies the output should be organized by slot number. The default is to organize the output by the order of the drives (e.g. sda, sdb etc).

-cols N

Specifies the number of columns to use for the table when generating HTML output. The default is 12.


Generates this output.


Specifies that the output should be in HTML format.

-idfile file

Specifies the path to the file which maps drive serial numbers to slots. This option sets -byslot. If 'file' is DATA the program will use the table in the DATA section. This is a simple ASCII file of columar data of serial numbers and slot numbers:

  ST3160021A_3JS01DCV 0
  92048D8_W8H02ZJA 1

Specifies that the partition information is not to be displayed.

-outfile file

Specifies that the output should be written to the file 'file'. The default is write output to STDOUT.

-title string

Specifies a title string to be written at the top of the output.


Specifies that additional debugging information should be written to STDOUT.


If no fatal errors are detected, the program exits with a return code of 0. Any error will set a non-zero return code.


Written by Terry Gliedt I<E<lt>tpg@hps.comE<gt>> in 2008. This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; See