KittyKatt / screenFetch

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

Screenfetch reporting wrong total filesystem size when complicated mountings are used #696

Open JakkuSakura opened 3 years ago

JakkuSakura commented 3 years ago

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

[x] bug report
[ ] new distro request

Bug report The filesystem size reported is 6.6T, three times as my actual disks. Probably because I have complicated mountings.

➜  ~ screenfetch -v
:: Finding distro...found as 'Manjaro 20.2'
:: Finding hostname and user...found as 'jack@jack-pc'
:: Finding kernel version...found as 'x86_64 Linux 5.8.18-1-MANJARO'
:: Finding current uptime...found as '1h 9m'
:: Finding current package count...found as '1881'
:: Finding current shell...found as 'zsh 5.8'
:: Finding current resolution(s)...found as '3840x2160'
:: Finding desktop environment...found as 'Xfce4'
:: Finding window manager...found as 'Xfwm4'
:: Finding window manager theme...found as 'Matcha-sea'
:: Finding GTK2 theme...found as 'Matcha-sea'
:: Finding GTK3 theme...found as 'Not Found'
:: Finding icon theme...found as 'Papirus-Maia'
:: Finding user font...found as 'Noto Sans 12'
:: Finding current CPU...found as 'AMD Ryzen 7 3700X 8-Core @ 16x 3.6GHz'
:: Finding current disk usage...found as '802G / 6.6T (12%%)'
:: Finding current GPU...found as 'GeForce GTX 1660'
:: Finding current RAM usage...found as '3843MiB / 16019MiB'

 ██████████████████  ████████     jack@jack-pc
 ██████████████████  ████████     OS: Manjaro 20.2 Nibia
 ██████████████████  ████████     Kernel: x86_64 Linux 5.8.18-1-MANJARO
 ██████████████████  ████████     Uptime: 1h 9m
 ████████            ████████     Packages: 1881
 ████████  ████████  ████████     Shell: zsh 5.8
 ████████  ████████  ████████     Resolution: 3840x2160
 ████████  ████████  ████████     DE: Xfce4
 ████████  ████████  ████████     WM: Xfwm4
 ████████  ████████  ████████     WM Theme: Matcha-sea
 ████████  ████████  ████████     GTK Theme: Matcha-sea [GTK2]
 ████████  ████████  ████████     Icon Theme: Papirus-Maia
 ████████  ████████  ████████     Font: Noto Sans 12
 ████████  ████████  ████████     Disk: 802G / 6.6T (12%)
                                  CPU: AMD Ryzen 7 3700X 8-Core @ 16x 3.6GHz
                                  GPU: GeForce GTX 1660
                                  RAM: 3843MiB / 16019MiB
➜  ~ sudo fdisk -l
[sudo] password for jack: 
Disk /dev/nvme0n1: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: WDC WDS250G2B0C-00PXH0                  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3AD5F484-C557-4B2C-9B6A-573922035BC9

Device             Start       End   Sectors  Size Type
/dev/nvme0n1p1      2048    616447    614400  300M EFI System
/dev/nvme0n1p2    616448    878591    262144  128M Microsoft reserved
/dev/nvme0n1p3    878592 378367999 377489408  180G Linux filesystem
/dev/nvme0n1p4 378368000 488397134 110029135 52.5G Microsoft basic data

Disk /dev/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EZRX-00D
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x8f937ffe

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *          2048  824115199  824113152   393G  7 HPFS/NTFS/exFAT
/dev/sda2        824115200 3292962815 2468847616   1.1T 83 Linux
/dev/sda3       3292962816 3907029167  614066352 292.8G  7 HPFS/NTFS/exFAT
➜  ~ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8158756k,nr_inodes=2039689,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p3 on / type ext4 (rw,noatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18506)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=8201820k,nr_inodes=409600)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda2 on /hhd type ext4 (rw,noatime)
/dev/sda2 on /home type ext4 (rw,noatime)
/dev/sda2 on /opt type ext4 (rw,noatime)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/nvme0n1p3 on /home/jack/Dev type ext4 (rw,noatime)
/dev/nvme0n1p3 on /hhd/home/jack/Dev type ext4 (rw,noatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1640360k,nr_inodes=410090,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
hkust: on /home/jack/onedrive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
hkust: on /hhd/home/jack/onedrive type fuse.rclone (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sda3 on /run/media/jack/Data type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
hadzhiyski commented 3 years ago

This is happening on Fedora 33 with the default btrfs setup

➜ screenfetch -v
:: Finding distro...found as 'Fedora '
:: Finding hostname and user...found as 'hadzhiyski@aquarius'
:: Finding kernel version...found as 'x86_64 Linux 5.10.17-200.fc33.x86_64'
:: Finding current uptime...found as '1h 36m'
:: Finding current package count...found as '2075'
:: Finding current shell...found as 'fish 3.1.2'
:: Finding current resolution(s)...found as '3840x1080'
:: Finding desktop environment...found as 'GNOME 3.38.4'
:: Finding window manager...found as 'Mutter'
:: Finding window manager theme...found as 'Materia-dark-compact'
:: Finding GTK2 theme...found as 'Materia-dark-compact'
:: Finding GTK3 theme...found as 'Materia-dark-compact'
:: Finding icon theme...found as 'Paper'
:: Finding user font...found as 'Cantarell 11'
:: Finding current CPU...found as 'Intel Core i7-9700 @ 8x 4.7GHz [33.0°C]'
:: Finding current disk usage...found as '89G / 2.7T (4%%)'
:: Finding current GPU...found as 'Radeon RX 580 Series (POLARIS10, DRM 3.40.0, 5.10.17-200.fc33.x86_64, LLVM 11.0.0)'
:: Finding current RAM usage...found as '3377MiB / 15921MiB'
           /:-------------:\          hadzhiyski@aquarius
        :-------------------::        OS: Fedora 
      :-----------/shhOHbmp---:\      Kernel: x86_64 Linux 5.10.17-200.fc33.x86_64
    /-----------omMMMNNNMMD  ---:     Uptime: 1h 36m
   :-----------sMMMMNMNMP.    ---:    Packages: 2075
  :-----------:MMMdP-------    ---\   Shell: fish 3.1.2
 ,------------:MMMd--------    ---:   Resolution: 3840x1080
 :------------:MMMd-------    .---:   DE: GNOME 3.38.4
 :----    oNMMMMMMMMMNho     .----:   WM: Mutter
 :--     .+shhhMMMmhhy++   .------/   WM Theme: Materia-dark-compact
 :-    -------:MMMd--------------:    GTK Theme: Materia-dark-compact [GTK2/3]
 :-   --------/MMMd-------------;     Icon Theme: Paper
 :-    ------/hMMMy------------:      Font: Cantarell 11
 :-- :dMNdhhdNMMNo------------;       Disk: 89G / 2.7T (4%)
 :---:sdNMMMMNds:------------:        CPU: Intel Core i7-9700 @ 8x 4.7GHz [33.0°C]
 :------:://:-------------::          GPU: Radeon RX 580 Series (POLARIS10, DRM 3.40.0, 5.10.17-200.fc33.x86_64, LLVM 11.0.0)
 :---------------------://            RAM: 3377MiB / 15921MiB
➜ sudo fdisk -l
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 970 EVO Plus 500GB          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9ED6A4B6-2ED4-5B4C-8123-B29EB5B09E53

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048   1230847   1228800   600M EFI System
/dev/nvme0n1p2   1230848   3327999   2097152     1G Linux filesystem
/dev/nvme0n1p3   3328000 929898495 926570496 441.8G Linux filesystem
/dev/nvme0n1p4 929898496 976773119  46874624  22.4G Linux swap

Disk /dev/nvme1n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 970 EVO Plus 1TB            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 01BFFB27-A6F7-5A42-82E1-C101CDD7B13E

Device         Start        End    Sectors   Size Type
/dev/nvme1n1p1  2048 1953523711 1953521664 931.5G Linux filesystem

Disk /dev/zram0: 4 GiB, 4294967296 bytes, 1048576 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
➜ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,seclabel,size=8128056k,nr_inodes=2032014,mode=755,inode64)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=3260824k,nr_inodes=819200,mode=755,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
/dev/nvme0n1p3 on / type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=256,subvol=/root)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14189)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p3 on /home type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home)
/dev/nvme0n1p2 on /boot type ext4 (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,size=8152056k,nr_inodes=409600,inode64)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=1630408k,nr_inodes=407602,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
KittyKatt commented 3 years ago

Need to setup a VM to test this setup out. I'll have too look through detectDisk logic to figure out what's going on here.

nedy13 commented 3 years ago

I observe the same issue. I checked a little bit the script. Don't really understand why this happened.

I executed the parts in the script directly in the console.

➜  ~ totaldisk=$(df -h -x aufs -x tmpfs -x overlay -x drvfs --total 2>/dev/null | tail -1)
➜  ~ echo $totaldisk
total           467G    6,1G  437G    2% -

➜  ~ disktotal=$(awk '{print $2}' <<< "${totaldisk}")
        diskused=$(awk '{print $3}' <<< "${totaldisk}")                                                                                
        diskusedper=$(awk '{print $5}' <<< "${totaldisk}")                                                                          
        diskusage="${diskused} / ${disktotal} (${diskusedper})"                                                                
        diskusage_verbose=$(sed 's/%/%%/' <<< "$diskusage")                                                                        

➜  ~ echo $diskused
6,1G

➜  ~ echo $disktotal
467G

➜  ~ echo $diskusedper
2%
➜  ~ echo $diskusage_verbose
6,1G / 467G (2%%)

➜  ~ mydisk=$(echo -e "$labelcolor Disk:$textcolor $diskusage")
➜  ~ echo $mydisk
 Disk: 6,1G / 467G (2%)

➜  ~ screenfetch -d '+disk'
    .',;:cc;,'.    .,;::c:,,.    pi@nedy-el02
   ,ooolcloooo:  'oooooccloo:    OS: Raspbian 10 buster
   .looooc;;:ol  :oc;;:ooooo'    Kernel: armv7l Linux 5.10.17-v7l+
     ;oooooo:      ,ooooooc.     Uptime: 2d 2h 42m
       .,:;'.       .;:;'.       Packages: 552
       .... ..'''''. ....        Shell: 916
     .''.   ..'''''.  ..''.      Disk: 30G / 1,4T (3%)
     ..  .....    .....  ..      CPU: ARMv7 rev 3 (v7l) @ 4x 1.5GHz [47.7°C]
    .  .'''''''  .''''''.  .     GPU: 
  .'' .''''''''  .'''''''. ''.   RAM: 404MiB / 7886MiB
  '''  '''''''    .''''''  '''  
  .'    ........... ...    .'.  
    ....    ''''''''.   .''.    
    '''''.  ''''''''. .'''''    
     '''''.  .'''''. .'''''.    
      ..''.     .    .''..      
            .'''''''            
             ......             

Is there something I have missed to check? What can I do to help with this issue?

david-0609 commented 3 years ago

Same issue on fedora 34, screenfetch detected the usage as 102G/968G, which are both double my actual storage space and usage

stlouisn commented 1 year ago

Please add update screenfetch-dev line 1768 from:

totaldisk=$(df -h -x aufs -x tmpfs -x overlay -x drvfs -x devtmpfs --total 2>/dev/null | tail -1)

to:

totaldisk=$(df -h -x aufs -x tmpfs -x overlay -x drvfs -x devtmpfs -x fuse -x fuse.mergerfs --total 2>/dev/null | tail -1)
username227 commented 3 months ago

I am having this issue with Arch. I have a simple 8TB NAS that is mounted with fstab, and the disk size is reported as combined with my hard drive, which is incorrect.