KittyKatt / screenFetch

Fetches system/theme information in terminal for Linux desktop screenshots.
GNU General Public License v3.0
3.85k stars 454 forks source link

Invalid disk usage on macOS Catalina #646

Closed BlueGone closed 2 years ago

BlueGone commented 4 years ago

I'm submitting a ... (check one with "x")

[x] bug report
[ ] new distro request

Bug report On macOS Catalina, the displayed disk usage (percentage and usage) is invalid:

:: Finding distro...found as 'Mac OS X '
:: Finding hostname and user...found as 'placaist@placaist-elitebook-macos'
:: Finding kernel version...found as 'x86_64 Darwin 19.0.0'
:: Finding current uptime...found as '1h 19m'
:: Finding current package count...found as '77'
:: Finding current shell...found as 'zsh 5.7.1'
:: Finding current resolution(s)...found as '1920x1080 '
:: Finding desktop environment...found as 'Aqua'
:: Finding window manager...found as 'Quartz Compositor'
:: Finding window manager theme...found as 'Blue'
:: Finding GTK2 theme...found as 'Not Applicable'
:: Finding GTK3 theme...found as 'Not Applicable'
:: Finding icon theme...found as 'Not Applicable'
:: Finding user font...found as ''
:: Finding current CPU...found as 'Intel Core i7-6500U @ 2.50GHz'
:: Finding current disk usage...found as '11G / 512G (3%%)'
:: Finding current GPU...found as 'Intel HD Graphics 520 '
:: Finding current RAM usage...found as '4770MiB / 8192MiB'

                 -/+:.          placaist@placaist-elitebook-macos
                :++++.          OS: 64bit Mac OS X 10.15 19A583
               /+++/.           Kernel: x86_64 Darwin 19.0.0
       .:-::- .+/:-``.::-       Uptime: 1h 19m
    .:/++++++/::::/++++++/:`    Packages: 77
  .:///////////////////////:`   Shell: zsh 5.7.1
  ////////////////////////`     Resolution: 1920x1080 
 -+++++++++++++++++++++++`      DE: Aqua
 /++++++++++++++++++++++/       WM: Quartz Compositor
 /sssssssssssssssssssssss.      WM Theme: Blue
 :ssssssssssssssssssssssss-     Disk: 11G / 512G (3%)
  osssssssssssssssssssssssso/`  CPU: Intel Core i7-6500U @ 2.50GHz
  `syyyyyyyyyyyyyyyyyyyyyyyy+`  GPU: Intel HD Graphics 520 
   `ossssssssssssssssssssss/    RAM: 4770MiB / 8192MiB
     :ooooooooooooooooooo+.    
      `:+oo+/:-..-:/+o+/-      

It is due to the fact that Catalina features a new partition scheme, separating the core system (mounted on / as read-only), and the rest of the system (mounted as /System/Volumes/Data). As an exemple, here is the output of df -H:

Filesystem      Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk2s5    512G    11G   413G     3%  481711 4998545969    0%   /
devfs           198k   198k     0B   100%     674          0  100%   /dev
/dev/disk2s1    512G    87G   413G    18%  455467 4998572213    0%   /System/Volumes/Data
/dev/disk2s4    512G   1.1G   413G     1%       2 4999027678    0%   /private/var/vm
map auto_home     0B     0B     0B   100%       0          0  100%   /System/Volumes/Data/home

and associated screenshots of Disk Utility: Screenshot 2019-10-10 at 15 27 52 Screenshot 2019-10-10 at 15 28 07 Screenshot 2019-10-10 at 15 28 20

KittyKatt commented 4 years ago

Interesting. I may have to use you as a guinea pig for this one @BlueGone as macOS is the only system I have no access to.

BlueGone commented 4 years ago

Maybe it is problem with all APFS systems. The output of diskutil apfs list give exploitable data:

APFS Container (1 found)                                                                        
|    
+-- Container disk2 A2E15A1D-6F7C-415B-A1B7-58301D43E63C           
    ====================================================           
    APFS Container Reference:     disk2    
    Size (Capacity Ceiling):      511900434432 B (511.9 GB)  
    Capacity In Use By Volumes:   102448488448 B (102.4 GB) (20.0% used)
    Capacity Not Allocated:       409451945984 B (409.5 GB) (80.0% free)
    |                                                                                           
    +-< Physical Store disk1s2 5BA69665-334D-4AAF-B252-F8307881566F
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk1s2                                                     
    |   Size:                       511900434432 B (511.9 GB)
    |                                
    +-> Volume disk2s1 7ED28FE3-A580-4A42-BE6B-C1F88A6C4939
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s1 (Data)          
    |   Name:                      macos - Data (Case-insensitive)
    |   Mount Point:               /System/Volumes/Data      
    |   Capacity Consumed:         89982230528 B (90.0 GB)
    |   FileVault:                 No                                                           
    |                                
    +-> Volume disk2s2 F3113ADB-4757-4725-B0FD-C816DAA43135
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s2 (Preboot)       
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted                                                  
    |   Capacity Consumed:         85151744 B (85.2 MB)
    |   FileVault:                 No                                                           
    |                                
    +-> Volume disk2s3 5F2EC600-7589-43F0-B036-28A0952B281A
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s3 (Recovery)      
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted                                                  
    |   Capacity Consumed:         528945152 B (528.9 MB)
    |   FileVault:                 No                                                           
    |                                
    +-> Volume disk2s4 916FA6C3-3816-4FB9-B2C9-AF94CAD0A3A9
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s4 (VM)                                                 
    |   Name:                      VM (Case-insensitive)
    |   Mount Point:               /private/var/vm         
    |   Capacity Consumed:         1074810880 B (1.1 GB)
    |   FileVault:                 No                                                           
    |                                
    +-> Volume disk2s5 BD729F7A-C3FB-47D2-9D44-958A6746CF0A
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk2s5 (System)
        Name:                      macos (Case-insensitive)
        Mount Point:               /
        Capacity Consumed:         10614734848 B (10.6 GB)
        FileVault:                 No

I just don't really know if it is reliable to depends on this command. What if there is more than 1 APFS container ? What is the return code of the command if there is no APFS container ? If there is an apfs container, but that the system is not on it ? 🤷‍♂️

KittyKatt commented 4 years ago

Oh, that could be very useful. But you bring up some valid concerns. I think to solve this issue we'll probably need to make some assumptions about APFS containers and the majority of use cases. Particularly this

Size (Capacity Ceiling): 511900434432 B (511.9 GB) Capacity In Use By Volumes: 102448488448 B (102.4 GB) (20.0% used)

Is useful in the first few lines.

ghost commented 4 years ago

Im also on 10.5 (Mac book air 2015) and I can help + am experiencing this issue. Not sure if it helps but Apple filesystem documentation

BlueGone commented 2 years ago

Resolved by #664