SUSE Support

Here When You Need Us

snmpwalk hrstorage reports incorrect sizes

This document (000020961) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15 SP4
SUSE Linux Enterprise Server 15 SP3

Situation

A "df" report shows certain sizes for /home and other file systems, but snmpwalk hrstorage reports incorrect values.

For example:

 # /bin/df -Th
# (this output has been trimmed)

Filesystem                     Type      Size  Used Avail Use% Mounted on
tmpfs                          tmpfs     362M   38M  325M  11% /run
/dev/mapper/system-root        btrfs     1.0G  480M  354M  58% /
/dev/mapper/system-home        btrfs      43G   34G  9.4G  78% /home

Below, the root file system ("/") reports correctly within snmpwalk output, as the "Size" and "Used" values, when multiplied by the Unit (4096), is the same size as reported in "df".  For example, Size 262144 x 4096 = 1073741824, aka 1 GB:

HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 262144
HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 122888

However, the /home file system (and possibly others) report incorrect values:

HOST-RESOURCES-MIB::hrStorageIndex.78 = INTEGER: 78
HOST-RESOURCES-MIB::hrStorageType.78 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.78 = STRING: /home
HOST-RESOURCES-MIB::hrStorageAllocationUnits.78 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageSize.78 = INTEGER: 92575
HOST-RESOURCES-MIB::hrStorageUsed.78 = INTEGER: 9558

If those values are calculated together, the result (for example 92575 x 4096 = 379,187,200 = approx 362 MB) is incorrect for that file system.  Incidentally, that size value actually belongs to the tmpfs file system mounted at /run, instead.
 

Resolution

If maintenance updates for your SLES distribution provide net-snmp 5.9.3-150300.15.8.1, update to that version (or higher).

Alternatively, the problem can be manually corrected with these steps:

1.  Execute:  systemctl edit snmpd

That will create /etc/systemd/system/snmpd.service.d/override.conf and bring it up in an editor.

2.  Insert into that file:
[Service]
ProtectHome=false

3.  After saving and exiting that file, execute:
systemctl daemon-reload
systemctl restart snmpd

Cause

A previous update intended to harden security of snmpd enabled an option called "ProtectHome".  This has the side effect of causing /home (and possibly other file systems) to be classified as a tmpfs and return incorrect results.  The hardening patch has been reworked / replaced, and the new one does not contain that option.

From the changelog of net-snmp 5.9.3-150300.15.8.1 (trimmed):

* Mon Jan 09 2023 
- Hardening systemd services setting "ProtectHome=true" caused home directory
  size and allocation to be listed incorrectly (bsc#1206044).
  add:
  * net-snmp-5.9.3-harden_snmpd.service.patch
  delete:
  * net-snmp-5.9.1-harden_snmpd.service.patch

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020961
  • Creation Date: 31-Jan-2023
  • Modified Date:31-Jan-2023
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.