mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 09:49:28 +08:00
add ability to specify partition for extra disk using folder name
This commit is contained in:
@@ -41,11 +41,20 @@ func (a *Agent) initializeDiskInfo() {
|
|||||||
if _, exists := a.fsStats[key]; !exists {
|
if _, exists := a.fsStats[key]; !exists {
|
||||||
if root {
|
if root {
|
||||||
slog.Info("Detected root device", "name", key)
|
slog.Info("Detected root device", "name", key)
|
||||||
// check if root device is in /proc/diskstats, use fallback if not
|
// Check if root device is in /proc/diskstats, use fallback if not
|
||||||
if _, exists := diskIoCounters[key]; !exists {
|
if _, exists := diskIoCounters[key]; !exists {
|
||||||
slog.Warn("Device not found in diskstats", "name", key)
|
|
||||||
key = findFallbackIoDevice(filesystem, diskIoCounters, a.fsStats)
|
key = findFallbackIoDevice(filesystem, diskIoCounters, a.fsStats)
|
||||||
slog.Info("Using I/O fallback", "name", key)
|
slog.Info("Using I/O fallback", "device", device, "mountpoint", mountpoint, "fallback", key)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Check if non-root has diskstats and fall back to folder name if not
|
||||||
|
// Scenario: device is encrypted and named luks-2bcb02be-999d-4417-8d18-5c61e660fb6e - not in /proc/diskstats.
|
||||||
|
// However, the device can be specified by mounting folder from luks device at /extra-filesystems/sda1
|
||||||
|
if _, exists := diskIoCounters[key]; !exists {
|
||||||
|
efBase := filepath.Base(mountpoint)
|
||||||
|
if _, exists := diskIoCounters[efBase]; exists {
|
||||||
|
key = efBase
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.fsStats[key] = &system.FsStats{Root: root, Mountpoint: mountpoint}
|
a.fsStats[key] = &system.FsStats{Root: root, Mountpoint: mountpoint}
|
||||||
@@ -114,7 +123,7 @@ func (a *Agent) initializeDiskInfo() {
|
|||||||
mountpoint := filepath.Join(efPath, folder.Name())
|
mountpoint := filepath.Join(efPath, folder.Name())
|
||||||
slog.Debug("/extra-filesystems", "mountpoint", mountpoint)
|
slog.Debug("/extra-filesystems", "mountpoint", mountpoint)
|
||||||
if !existingMountpoints[mountpoint] {
|
if !existingMountpoints[mountpoint] {
|
||||||
a.fsStats[folder.Name()] = &system.FsStats{Mountpoint: mountpoint}
|
addFsStat(folder.Name(), mountpoint, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ If you don't need network stats, remove that line from the compose file and map
|
|||||||
### Binary
|
### Binary
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> If using Linux, see [guides/systemd.md](/supplemental/guides/systemd.md) for a script to install the hub or agent as a system service. The agent installer will be built into the web UI in the future.
|
> If using Linux, see [guides/systemd.md](/supplemental/guides/systemd.md) for a script to install the hub or agent as a system service. This is also built into the web UI.
|
||||||
|
|
||||||
Download and run the latest binaries from the [releases page](https://github.com/henrygd/beszel/releases) or use the commands below.
|
Download and run the latest binaries from the [releases page](https://github.com/henrygd/beszel/releases) or use the commands below.
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ Mount a folder from the target filesystem in the container's `/extra-filesystems
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/disk1/.beszel:/extra-filesystems/disk1:ro
|
- /mnt/disk1/.beszel:/extra-filesystems/sdb1:ro
|
||||||
- /dev/mmcblk0/.beszel:/extra-filesystems/sd-card:ro
|
- /dev/mmcblk0/.beszel:/extra-filesystems/mmcblk0:ro
|
||||||
```
|
```
|
||||||
|
|
||||||
### Binary
|
### Binary
|
||||||
|
Reference in New Issue
Block a user