LinuxCommandLibrary

ledctl

Control LEDs connected to a system

TLDR

Turn on the "Locate" LED for specified device(s)

$ sudo ledctl locate=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Locate" LED for specified device(s)
$ sudo ledctl locate_off=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Status" LED and "Failure" LED for specified device(s)
$ sudo ledctl off=[/dev/sda,/dev/sdb,...]
copy

Turn off the "Status" LED, "Failure" LED and "Locate" LED for specified device(s)
$ sudo ledctl normal=[/dev/sda,/dev/sdb,...]
copy

SYNOPSIS

ledctl [OPTIONS] COMMAND [DEVICE]
ledctl [OPTIONS] list
ledctl [OPTIONS] status DEVICE
ledctl [OPTIONS] help

PARAMETERS

-h, --help
    Display a help message and exit.

-v, --version
    Show version information and exit.

-D, --directory
    Specify the base directory for LED control interfaces, typically /sys/class/leds. Useful for non-standard setups.

-p, --persistent
    Set the LED pattern to be persistent across system reboots. This functionality depends on the underlying hardware and driver support.

-c, --clear
    Clear any previously set persistent LED pattern. This option is typically used in conjunction with a DEVICE argument to clear its specific persistent pattern.

DESCRIPTION

ledctl is a command-line utility designed to control the LED indicators on various storage devices, including NVMe, SATA, and SAS drives. It leverages the Linux kernel's leds subsystem to manage patterns such as locate, activity, and fault. This tool is particularly useful in server environments for system administrators to visually identify specific drives within a storage array, aid in troubleshooting, or confirm disk activity. It allows setting temporary patterns or, if supported by the hardware and driver, making patterns persistent across reboots. ledctl provides commands to activate, deactivate, or query the status of these visual indicators.

CAVEATS

Caveats and Limitations:
Requires CAP_SYS_ADMIN capability (root privileges) to modify LED states.
Functionality heavily depends on Linux kernel driver support for specific storage controllers and devices. Not all drives or HBAs will expose LED control through /sys/class/leds.
Persistent patterns (-p) are not supported by all hardware or drivers.

AVAILABLE COMMANDS

ledctl supports several commands to manage LED patterns:
• locate DEVICE: Activates a distinctive blink pattern for easy physical identification of the specified drive.
• activity DEVICE: Sets an activity pattern, typically indicating I/O operations.
• fault DEVICE: Sets a fault pattern, signaling a problem with the drive.
• off DEVICE: Turns off all active LED patterns for the specified drive.
• on DEVICE: Turns on the default LED pattern for the device, often activity or locate.
• status DEVICE: Displays the currently active LED pattern for the specified drive.
• list: Lists all storage devices for which LED control is available via ledctl.

DEVICE NAMING

Devices are typically specified using their block device name, e.g., /dev/nvme0n1, /dev/sda, or their symbolic links like /dev/disk/by-id/nvme-eui.xxxxxxxxxxxxxxxxxxxxxxxxxxxx.

HISTORY

ledctl is often part of the libstoragemgmt project or systemd-leds packages, developed to provide a unified user-space interface for controlling hardware LEDs on storage devices. It abstracts the specifics of different vendor implementations (e.g., NVMe, SAS/SATA via various HBA drivers) through the kernel's leds subsystem. Its usage is primarily in server and data center environments for managing storage arrays.

SEE ALSO

lsblk(8), nvme(1), smartctl(8), systemd-led-control(8)

Copied to clipboard