Skip to content

Commit

Permalink
diskaman: fix extended partations issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lisaac committed Feb 18, 2020
1 parent a423789 commit fd6561f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
21 changes: 14 additions & 7 deletions luasrc/model/diskman.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions po/zh-cn/diskman.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid "DiskMan"
msgstr "DiskMan 磁盘管理"

msgid "Manage Disks over LuCI."
msgstr "通过LuCI管理磁盘"
msgstr "通过 LuCI 管理磁盘"

msgid "Rescan Disks"
msgstr "重新扫描磁盘"
Expand All @@ -26,7 +26,7 @@ msgid "Partition Table"
msgstr "分区表"

msgid "SATA Version"
msgstr "SATA版本"
msgstr "SATA 版本"

msgid "Health"
msgstr "健康"
Expand Down Expand Up @@ -125,7 +125,7 @@ msgid "Device Info"
msgstr "设备信息"

msgid "Disk Man"
msgstr "DiskMan磁盘管理"
msgstr "DiskMan 磁盘管理"

msgid "Partitions Info"
msgstr "分区信息"
Expand Down

0 comments on commit fd6561f

Please sign in to comment.