You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.4 KiB
39 lines
1.4 KiB
-- test.lua
|
|
local diskinfo = require("diskinfo")
|
|
local disks, err = diskinfo.get_info()
|
|
|
|
if not disks then
|
|
print("Error fetching disk info: " .. tostring(err))
|
|
os.exit(1)
|
|
end
|
|
|
|
print("==================================================================")
|
|
print("FREEBSD SYSTEM DISK TREE (With S.M.A.R.T. Temperature)")
|
|
print("==================================================================")
|
|
|
|
for _, disk_name in ipairs(disks._order) do
|
|
local disk = disks[disk_name]
|
|
|
|
-- Проверяем, вернул ли модуль температуру SMART для этого накопителя
|
|
local smart_str = ""
|
|
if disk.smart_temp then
|
|
smart_str = string.format(" | Temp: %d°C", disk.smart_temp)
|
|
end
|
|
|
|
print(string.format("Drive: %s [%s] | Type: %s%s", disk_name, disk.size, disk.type, smart_str))
|
|
print(string.format(" |- Hardware Model : %s", disk.model))
|
|
print(string.format(" |- Serial Number : %s", disk.serial))
|
|
print(" |- Partition Tree :")
|
|
|
|
if #disk.mounts._order == 0 then
|
|
print(" [No active mounts discovered on this device]")
|
|
else
|
|
for _, part_name in ipairs(disk.mounts._order) do
|
|
local partition = disk.mounts[part_name]
|
|
print(string.format(" -> %-10s | Path: %-20s | FS Type: %s",
|
|
part_name, partition.path, partition.type))
|
|
end
|
|
end
|
|
print(string.rep("-", 66))
|
|
end
|
|
|
|
|