luci-app-diskaman: fix extended partations issues

This commit is contained in:
CN_SZTL 2020-02-18 23:27:11 +08:00
parent 3ae160e0ad
commit a7d593e8fc
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 17 additions and 10 deletions

View File

@ -234,14 +234,21 @@ local get_parted_info = function(device)
table.insert(partitions_temp[disk_temp["extended_partition_index"]]["logicals"], i)
end
elseif (p["number"] < 4) and (p["number"] > 0) then
local real_size_sec = tonumber(nixio.fs.readfile("/sys/block/"..device.."/"..p["name"].."/size")) * tonumber(disk_temp.phy_sec)
if real_size_sec ~= p["size"] then
disk_temp["extended_partition_index"] = i
p["type"] = "extended"
p["size"] = real_size_sec
p["fs"] = "-"
p["logicals"] = {}
local s = nixio.fs.readfile("/sys/block/"..device.."/"..p["name"].."/size")
if s then
local real_size_sec = tonumber(s) * tonumber(disk_temp.phy_sec)
-- if size not equal, it's an extended
if real_size_sec ~= p["size"] then
disk_temp["extended_partition_index"] = i
p["type"] = "extended"
p["size"] = real_size_sec
p["fs"] = "-"
p["logicals"] = {}
else
p["type"] = "primary"
end
else
-- if not found in "/sys/block"
p["type"] = "primary"
end
end

View File

@ -5,7 +5,7 @@ msgid "DiskMan"
msgstr "DiskMan 磁盘管理"
msgid "Manage Disks over LuCI."
msgstr "通过LuCI管理磁盘"
msgstr "通过 LuCI 管理磁盘"
msgid "Rescan Disks"
msgstr "重新扫描磁盘"
@ -26,7 +26,7 @@ msgid "Partition Table"
msgstr "分区表"
msgid "SATA Version"
msgstr "SATA版本"
msgstr "SATA 版本"
msgid "Health"
msgstr "健康"
@ -125,7 +125,7 @@ msgid "Device Info"
msgstr "设备信息"
msgid "Disk Man"
msgstr "DiskMan磁盘管理"
msgstr "DiskMan 磁盘管理"
msgid "Partitions Info"
msgstr "分区信息"