Hello All,

I am currently trying to script a distribution independent way of determining the number of used and free RAM slots in server/desktop systems. I have been using dmidecode as this appears to be in most distributions that I have come across, however I noticed a problem recently. When I swapped out two 2GB modules of RAM for four x 1GB RAM modules I tested that all modules were being recognised using dmidecode. The problem is that dmidecode still showed 4 x 2GB of ram instead of 2 x 2GB and 4 x 1GB. This of course means I need to find an alternative way of getting the RAM slot usage from linux machines - that doesn't suffer from this problem.

I'm hoping there is something I have missed about dmidecode or that there is a better option such as probing /proc or /sys but any suggestions are welcome. Please note that I would ideally like this to be distribution independent so things such as hwinfo (from SuSE) are not as desirable.