[GH-ISSUE #1213] MacOS内存和存储显示计算问题不准确 #661

Closed
opened 2026-02-26 12:09:04 +03:00 by kerem · 1 comment
Owner

Originally created by @zouchengli on GitHub (Jul 5, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1213

Image
Originally created by @zouchengli on GitHub (Jul 5, 2025). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1213 <img width="516" height="363" alt="Image" src="https://github.com/user-attachments/assets/42048bbd-8e53-4330-935f-46253b48ebe2" />
kerem 2026-02-26 12:09:04 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Jul 5, 2025):

8f8cb6d05 中,我修复了 macOS 下硬盘统计数据出错的问题,以我 1T 配置为例,输出的是 995GB (926GiB),符合 df -h 的输出结果

df -h
Filesystem                         Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk3s1s1                    926Gi    10Gi   153Gi     7%    426k  1.6G    0%   /
devfs                             350Ki   350Ki     0Bi   100%    1.2k     0  100%   /dev
/dev/disk3s6                      926Gi   3.0Gi   153Gi     2%       3  1.6G    0%   /System/Volumes/VM
/dev/disk3s2                      926Gi   6.7Gi   153Gi     5%    1.3k  1.6G    0%   /System/Volumes/Preboot
/dev/disk3s4                      926Gi   1.7Mi   153Gi     1%      56  1.6G    0%   /System/Volumes/Update
/dev/disk1s2                      500Mi   6.0Mi   481Mi     2%       1  4.9M    0%   /System/Volumes/xarts
/dev/disk1s1                      500Mi   5.4Mi   481Mi     2%      32  4.9M    0%   /System/Volumes/iSCPreboot
/dev/disk1s3                      500Mi   3.2Mi   481Mi     1%      70  4.9M    0%   /System/Volumes/Hardware
/dev/disk3s5                      926Gi   752Gi   153Gi    84%     12M  1.6G    1%   /System/Volumes/Data
map auto_home                       0Bi     0Bi     0Bi   100%       0     0     -   /System/Volumes/Data/home
OrbStack:/OrbStack                173Gi    29Gi   145Gi    17%       0     0     -   /Users/Jacky/OrbStack
/Applications/Weibo.app/Wrapper   926Gi   769Gi   139Gi    85%     14M  1.5G    1%   /private/var/folders/6c/5n5snlf17530r44clwjjt0_00000gn/X/431D1EE6-76BF-57F6-9369-582EF4B4E4F2

关于内存用量,以我的 32G 内存的 Mac 为例:

sysctl -n hw.memsize
34359738368

macOS 返回的物理内存总量,单位为字节 (bytes)

• 按 10 进制(1 GB = 10^9 B)换算约为 34.36 GB,四舍五入写成 “34 GB” 基本无误
• 按 2 进制(1 GiB = 2^30 B)换算恰为 32 GiB

References

<!-- gh-comment-id:3039149406 --> @0xJacky commented on GitHub (Jul 5, 2025): 在 8f8cb6d05 中,我修复了 macOS 下硬盘统计数据出错的问题,以我 1T 配置为例,输出的是 995GB (926GiB),符合 `df -h` 的输出结果 ``` df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk3s1s1 926Gi 10Gi 153Gi 7% 426k 1.6G 0% / devfs 350Ki 350Ki 0Bi 100% 1.2k 0 100% /dev /dev/disk3s6 926Gi 3.0Gi 153Gi 2% 3 1.6G 0% /System/Volumes/VM /dev/disk3s2 926Gi 6.7Gi 153Gi 5% 1.3k 1.6G 0% /System/Volumes/Preboot /dev/disk3s4 926Gi 1.7Mi 153Gi 1% 56 1.6G 0% /System/Volumes/Update /dev/disk1s2 500Mi 6.0Mi 481Mi 2% 1 4.9M 0% /System/Volumes/xarts /dev/disk1s1 500Mi 5.4Mi 481Mi 2% 32 4.9M 0% /System/Volumes/iSCPreboot /dev/disk1s3 500Mi 3.2Mi 481Mi 1% 70 4.9M 0% /System/Volumes/Hardware /dev/disk3s5 926Gi 752Gi 153Gi 84% 12M 1.6G 1% /System/Volumes/Data map auto_home 0Bi 0Bi 0Bi 100% 0 0 - /System/Volumes/Data/home OrbStack:/OrbStack 173Gi 29Gi 145Gi 17% 0 0 - /Users/Jacky/OrbStack /Applications/Weibo.app/Wrapper 926Gi 769Gi 139Gi 85% 14M 1.5G 1% /private/var/folders/6c/5n5snlf17530r44clwjjt0_00000gn/X/431D1EE6-76BF-57F6-9369-582EF4B4E4F2 ``` 关于内存用量,以我的 32G 内存的 Mac 为例: ``` sysctl -n hw.memsize 34359738368 ``` macOS 返回的物理内存总量,单位为字节 (bytes) • 按 10 进制(1 GB = 10^9 B)换算约为 34.36 GB,四舍五入写成 “34 GB” 基本无误 • 按 2 进制(1 GiB = 2^30 B)换算恰为 32 GiB References - [Super User – “Mac OS X sysctl get total and free memory size”](https://superuser.com/questions/197059/mac-os-x-sysctl-get-total-and-free-memory-size) - [Apple Support Community – “sysctl physmem vs memsize”](https://discussions.apple.com/thread/1753088) - [Stack Overflow – “Determine physical mem size programmatically on OS X”](https://stackoverflow.com/questions/583736/determine-physical-mem-size-programmatically-on-osx/818741) - [Apple Stack Exchange – “How do I find out how many bytes of memory my machine has in RAM?”](https://apple.stackexchange.com/questions/284830/how-do-i-find-out-how-many-bytes-of-memory-my-machine-has-in-ram) - [matisse.net Bit Calculator – 34359738368 bytes conversion](https://www.matisse.net/bitcalc/?input_amount=34359738368&input_units=bytes&notation=legacy) - [ConvertUnits.com – Byte → GiB converter](https://www.convertunits.com/from/byte/to/GiB) - [Flightpedia – “34359738368 Byte to Gigabyte”](https://www.flightpedia.org/convert/34359738368-bytes-to-gigabytes.html) - [UnitConverters.net – Byte ↔ Gigabyte](https://www.unitconverters.net/data-storage/byte-to-gigabyte.htm)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#661
No description provided.