Skip to content

Commit

Permalink
update the doc about HCTL mapping (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
miskcoo committed Jun 17, 2024
1 parent dbc92db commit f161948
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ echo 1 > /sys/class/leds/$led/rx
echo 100 > /sys/class/leds/$led/interval
```

To blink the `disk` LED when a block device is active, you can use the `ledtrig-oneshot` module and monitor the changes of`/sys/block/sda/stat` (see `scripts/ugreen-diskiomon` for an example). If you are using zfs, you can combine this script with that provided in [#1](https://github.com/miskcoo/ugreen_dx4600_leds_controller/issues/1) to change the LED's color when a disk drive failure occurs.
To blink the `disk` LED when a block device is active, you can use the `ledtrig-oneshot` module and monitor the changes of`/sys/block/sda/stat` (see `scripts/ugreen-diskiomon` for an example). If you are using zfs, you can combine this script with that provided in [#1](https://github.com/miskcoo/ugreen_dx4600_leds_controller/issues/1) to change the LED's color when a disk drive failure occurs. To see how to map the disk LEDs to correct disk slots, please read the [Disk Mapping](#disk-mapping) section.

#### Start at Boot (for Debian 12)

Expand Down Expand Up @@ -181,6 +181,27 @@ systemctl start ugreen-ledmon@enp2s0
systemctl enable ugreen-ledmon@enp2s0
```

## Disk Mapping

To make the disk LEDs useful, we should map the disk LEDs to correct disk slots. First of all, we should highlight that using `/dev/sdX` is never a smart idea, as it may change at every boot. In the script `ugreen-diskiomon` we provide two mapping methods: **by HCTL** and **by serial**.

The HCTL mapping depends on how the SATA controllers are connected to the PCIe bus and the disk slots. To check the HCTL order, you can run the following command, and check the serial of your disks:

```bash
# lsblk -S -x hctl -o name,hctl,serial
NAME HCTL SERIAL
sda 0:0:0:0 XXKEREXX
sdc 1:0:0:0 XXKG2BXX
sdb 2:0:0:0 XXGMU6XX
sdd 3:0:0:0 XXKJEZXX
sde 4:0:0:0 XXKJHBXX
sdf 5:0:0:0 XXGT2ZXX
sdg 6:0:0:0 XXKH3SXX
sdh 7:0:0:0 XXJDB1XX
```

As far as we know, the mapping between HCTL and the disk serial are stable at each boot (see [#4](https://github.com/miskcoo/ugreen_dx4600_leds_controller/pull/4) and [#9](https://github.com/miskcoo/ugreen_dx4600_leds_controller/issues/9)). However, it has been reported that the exact order is model-dependent (see [#9](https://github.com/miskcoo/ugreen_dx4600_leds_controller/issues/9)). In DX4600 Pro and DXP8800 Plus, the mapping is `X:0:0:0 -> diskX`, but In the DXP6800 Pro, `0:0:0:0` and `1:0:0:0` are mapped to `disk5` and `disk6`, and `2:0:0:0` to `6:0:0:0` are mapped to `disk1` to `disk4`, so you should change the array `hctl_map` in `ugreen-diskiomon` accordingly.

## Communication Protocols

The IDs for the six LED lights on the front panel of the chassis are as follows:
Expand Down
8 changes: 7 additions & 1 deletion scripts/ugreen-diskiomon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
# led-disk mapping (see https://github.com/miskcoo/ugreen_dx4600_leds_controller/pull/4)
mapping_method=hctl # hctl, serial
led_map=(disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8)
# hctl, $> lsblk -S -o name,hctl

# hctl, $> lsblk -S -x hctl -o hctl,serial,name
# NOTE: It is reported that the order below should be adjusted for each model.
# It is tested that the following order is correct in DX4600 Pro and DXP8800 Plus.
# But for DXP6800 Pro, it should be
# hctl_map=("4:0:0:0" "5:0:0:0" "0:0:0:0" "1:0:0:0" "2:0:0:0" "3:0:0:0" "6:0:0:0" "7:0:0:0")
# Please check the disk mapping section in https://github.com/miskcoo/ugreen_dx4600_leds_controller/blob/master/README.md.
hctl_map=("0:0:0:0" "1:0:0:0" "2:0:0:0" "3:0:0:0" "4:0:0:0" "5:0:0:0" "6:0:0:0" "7:0:0:0")
# serial number, $> lsblk -S -x hctl -o hctl,serial,name
serial_map=("placeholder0" "placeholder1" "placeholder2" "placeholder3" "placeholder4" "placeholder5" "placeholder6" "placeholder7")
Expand Down

0 comments on commit f161948

Please sign in to comment.