Skip to content

Commit

Permalink
Remove --fstab from findmnt call in sysinfo
Browse files Browse the repository at this point in the history
Initially I used this argument as I work with systems with a lot of bind mounts
and it felt unnecessary to list them all, eg:

  Mount points                         Disk usage       Inodes usage
 /                                   49%  of 19.3G     12.8% of 1299984
 /rw                                 35%  of 20.5G     26.3% of 1373568
 /home                               35%  of 20.5G     26.3% of 1373568
 /usr/local                          35%  of 20.5G     26.3% of 1373568
 /var/spool/cron                     35%  of 20.5G     26.3% of 1373568
 /etc/hosts                          35%  of 20.5G     26.3% of 1373568
 /var/lib/systemd/timers             35%  of 20.5G     26.3% of 1373568
 /var/lib/plocate                    35%  of 20.5G     26.3% of 1373568
 /var/lib/containerd                 35%  of 20.5G     26.3% of 1373568
 /etc/docker                         35%  of 20.5G     26.3% of 1373568
 /var/lib/docker                     35%  of 20.5G     26.3% of 1373568
 /home/user/.emacs.d/elpa            2%   of 3.9G      2.4% of 262144
 /rw/home/user/.emacs.d/elpa         2%   of 3.9G      2.4% of 262144
 /proc/xen                           -    of 0         100.0% of 00

However it seems impossible to filter theses mounts in one call,
(https://unix.stackexchange.com/questions/430074/how-to-exclude-bind-mounts-from-findmnt-results-list)
and --fstab is a bad compromise as mounts points may be declared in many others
ways than /etc/fstab.
  • Loading branch information
seven-beep committed Jan 23, 2025
1 parent 2225705 commit 83645cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,27 @@ Example:
Debian GNU/Linux 12 (bookworm) (kernel 6.1.0-7-amd64)
System information as of Wed Jan 22 15:35:40 2025 on x.x.x.x
System information as of Wed Jan 22 16:02:47 2025 on x.x.x.x
System load: 0.07 Processes: 244
System load: 0.07 Processes: 245
Memory usage: 26% Swap usage: 1%
Mount points Disk usage Inodes usage
/boot 12% of 977.3M 0.5% of 65808
/boot/efi 0% of 250.1M Not available
/ 13% of 19.6G 5.0% of 1310720
/home 1% of 7.8G 1.3% of 524288
/var 43% of 19.6G 16.6% of 1310720
/var/log 2% of 7.8G 0.0% of 524288
/var/log/audit 0% of 7.8G 0.0% of 524288
/var/tmp 0% of 4.8G 0.0% of 327680
5 logged in users:
admin from x.x.x.x at Tue Jan 21 22:43:37 2025
Mount points Disk usage Inodes usage
/ 13% of 19.6G 5.0% of 1310720
/boot 12% of 977.3M 0.5% of 65808
/var 43% of 19.6G 16.6% of 1310720
/home 1% of 7.8G 1.3% of 524288
/var/log 2% of 7.8G 0.0% of 524288
/var/tmp 0% of 4.8G 0.0% of 327680
/boot/efi 0% of 250.1M Not available
/var/log/audit 0% of 7.8G 0.0% of 524288
/srv/borg 0% of 1.3T 0.0% of 85901312
/srv/nextcloud 13% of 3T 0.0% of 201326592
/mnt/disquette 78% of 1.2T 0.1% of 82378752
2 logged in users:
user from x.x.x.x at Tue Jan 21 22:43:37 2025
user from x.x.x.x at Tue Jan 21 22:43:37 2025
No mail.
Last login: Mon Apr 3 07:28:01 2023 from laptop.example.org
Expand Down
5 changes: 2 additions & 3 deletions update-motd.d/sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def get_filesystems():
"--noheading",
"--real",
"--uniq",
"--fstab",
"--json",
"--types",
"notmpfs,noswap,nodevtmpfs",
Expand Down Expand Up @@ -139,12 +138,12 @@ def main():

print(
"""
Mount points Disk usage Inodes usage"""
Mount points Disk usage Inodes usage"""
)

for f in filesystems:
print(
" %-21s %-4s of %-9s %s" % (f["target"], f["use%"], f["size"], f["inodes%"])
" %-35s %-4s of %-9s %s" % (f["target"], f["use%"], f["size"], f["inodes%"])
)

if logged_users > 0:
Expand Down

0 comments on commit 83645cd

Please sign in to comment.