ใน macOS High Sierra ด้วยรูปแบบ SSD พร้อม APFS ฉันได้รับ:
diskutil info -all
Device Identifier: disk0
Device Node: /dev/disk0
Whole: Yes
Part of Whole: disk0
Device / Media Name: APPLE SSD SM0512L
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Content (IOContent): GUID_partition_scheme
OS Can Be Installed: No
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Disk Size: 500.3 GB (500277788672 Bytes) (exactly 977105056 512-Byte-Units)
Device Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk0s1
Device Node: /dev/disk0s1
Whole: No
Part of Whole: disk0
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Partition Type: EFI
OS Can Be Installed: No
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Volume UUID: E783267B-A4C3-3556-B751-DBED770EB996
Disk / Partition UUID: 4C82BF11-A7F4-4477-A189-500D6D646FD2
Partition Offset: 24576 Bytes (6 4096-Byte-Device-Blocks)
Disk Size: 314.6 MB (314572800 Bytes) (exactly 614400 512-Byte-Units)
Device Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk0s2
Device Node: /dev/disk0s2
Whole: No
Part of Whole: disk0
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Partition Type: Apple_APFS
OS Can Be Installed: No
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Disk / Partition UUID: 4A04D2CF-3476-402C-B7F7-891B43239CCA
Partition Offset: 314597376 Bytes (76806 4096-Byte-Device-Blocks)
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk1
Device Node: /dev/disk1
Whole: Yes
Part of Whole: disk1
Device / Media Name: APPLE SSD SM0512L
Volume Name: Not applicable (no file system)
Mounted: Not applicable (no file system)
File System: None
Content (IOContent): EF57347C-0000-11AA-AA11-00306543ECAC
OS Can Be Installed: No
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Disk / Partition UUID: 9A41D8CF-D5B1-4DD6-95B9-9AD553775115
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: Not applicable (no file system)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Virtual: Yes
Hardware AES Support: No
**********
Device Identifier: disk1s1
Device Node: /dev/disk1s1
Whole: No
Part of Whole: disk1
Volume Name: Macintosh SSD
Mounted: Yes
Mount Point: /
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Enabled
OS Can Be Installed: Yes
Booter Disk: disk1s2
Recovery Disk: disk1s3
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Volume UUID: 63FC8459-50EA-467F-9808-FE1FDCA3202F
Disk / Partition UUID: 63FC8459-50EA-467F-9808-FE1FDCA3202F
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Volume Used Space: 311.0 GB (311046836224 Bytes) (exactly 607513352 512-Byte-Units) (62.2%)
Volume Free Space: 188.9 GB (188916334592 Bytes) (exactly 368977216 512-Byte-Units) (37.8%)
Allocation Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: No
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk1s2
Device Node: /dev/disk1s2
Whole: No
Part of Whole: disk1
Volume Name: Preboot
Mounted: No
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Disabled
OS Can Be Installed: No
Booter Disk: disk1s2
Recovery Disk: disk1s3
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Volume UUID: D781C0DD-86C5-45D3-AC8E-835B81757689
Disk / Partition UUID: D781C0DD-86C5-45D3-AC8E-835B81757689
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 0 B (0 Bytes) (exactly 0 512-Byte-Units)
Volume Free Space: 0 B (0 Bytes) (exactly 0 512-Byte-Units)
Read-Only Media: No
Read-Only Volume: Not applicable (not mounted)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk1s3
Device Node: /dev/disk1s3
Whole: No
Part of Whole: disk1
Volume Name: Recovery
Mounted: No
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Disabled
OS Can Be Installed: No
Booter Disk: disk1s2
Recovery Disk: disk1s3
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Volume UUID: E223480E-7D24-4FBD-8936-60AFDD89865B
Disk / Partition UUID: E223480E-7D24-4FBD-8936-60AFDD89865B
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 0 B (0 Bytes) (exactly 0 512-Byte-Units)
Volume Free Space: 0 B (0 Bytes) (exactly 0 512-Byte-Units)
Read-Only Media: No
Read-Only Volume: Not applicable (not mounted)
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
Device Identifier: disk1s4
Device Node: /dev/disk1s4
Whole: No
Part of Whole: disk1
Volume Name: VM
Mounted: Yes
Mount Point: /private/var/vm
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Enabled
OS Can Be Installed: No
Booter Disk: disk1s2
Recovery Disk: disk1s3
Media Type: Generic
Protocol: PCI-Express
SMART Status: Not Supported
Volume UUID: 64D2BA51-6B59-4470-A71F-58E051AA54B5
Disk / Partition UUID: 64D2BA51-6B59-4470-A71F-58E051AA54B5
Disk Size: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
Volume Used Space: 311.0 GB (311046836224 Bytes) (exactly 607513352 512-Byte-Units) (62.2%)
Volume Free Space: 188.9 GB (188916334592 Bytes) (exactly 368977216 512-Byte-Units) (37.8%)
Allocation Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: No
Device Location: Internal
Removable Media: Fixed
Solid State: Yes
Hardware AES Support: No
**********
ฉันเพิ่งมี 512 GB SSD
ดังนั้นปัญหาของฉันคือวิธีการแยกวิเคราะห์ให้ถูกต้อง:
- พื้นที่ทั้งหมด
- พื้นที่ว่าง
จากผลลัพธ์ฉันไม่สามารถหาผลรวมของทุกบรรทัดที่ขึ้นต้นด้วย:
Volume Total Space
และ Volume Free Space
; ดูเหมือนว่าพวกเขาทั้งสองรายการสิ่งเดียวกัน:
Volume Total Space: 500.0 GB (499963170816 Bytes) (exactly 976490568 512-Byte-Units)
ลอง df -H ผลลัพธ์คือ:
df -H
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1s1 500G 309G 189G 63% 2397390 9223372036852378417 0% /
devfs 195k 195k 0B 100% 658 0 100% /dev
/dev/disk1s4 500G 1.1G 189G 1% 3 9223372036854775804 0% /private/var/vm
map -hosts 0B 0B 0B 100% 0 0 100% /net
map auto_home 0B 0B 0B 100% 0 0 100% /home
อีกครั้งมี 2 บรรทัด (สำหรับ / dev / disk1s1 และ / dev / disk1s4) แสดง:
Size 500G
และ Avail 189G
ฉันรู้ว่าพฤติกรรมนี้เกี่ยวข้องกับสิ่งใดบ้าง แต่อีกครั้งฉันต้องการตรรกะบางอย่างเพื่อกรอง รายการซ้ำ .
ฉันแค่ต้องการใช้คำสั่ง CLI หนึ่งคำสั่งหรือมากกว่านั้นซึ่งให้ฉันตอบคำถามนี้:
พื้นที่ทั้งหมดบนดิสก์ทั้งหมด (ผลรวม) บนโฮสต์นี้มีเท่าใดและมีอยู่ในดิสก์ทั้งหมด (ผลรวม) เท่าใด
df
?