This is

as days pass by, by Stuart Langridge

. Here I write about many things. In the past I wrote about other things but the past is past. I write code for people to play with, I write about my life on Twitter, and I write here.

On I wrote Memory scanner for Linux, on the subject of Rants and Linux.

I need to buy some memory for a desktop computer. Now, I hate buying memory because I never know what to buy. EDO, DDR, SD, PC133, PC100, it's all completely meaningless. People say; buy the right RAM to go with your motherboard. And find out what your motherboard is by opening the case. Then download some PDF manual from a very slow site in Taiwan and read it. And I still never know what to buy. Surely, I thought, it is possible to work out what my motherboard is from software, and cross-reference that with some Big List Of Allowed RAM somewhere on the web to have a small program that, when I run it, says "Go and buy PC133 SDRAM; you have two memory slots and each can take up to 512MB". You could even sell advertising space on it to RAM manufacturers if you were of a mind to, so when someone runs it they get a discreet little thing which says, underneath the description of what to buy, "click here to buy this specific item from Stuart's House Of RAM" or something. It took me, ooh, thirty seconds of poking around the web to discover the Crucial System Scanner, a download from the memory company Crucial, which does precisely and absolutely that. It's a great little program; download it (about 70K) and run it and it throws you at an appropriate page on their site listing details of your motherboard and which Crucial RAM sticks you can buy. The tragedy is that it's Windows-only. I was running it on a Windows machine anyway, so that's not too big a loss, but: why isn't there a free software version of this? Is "which RAM sticks am I rated for, and what type?" workable-out from /proc? If making the tool requires you to put a huge database of all the motherboards in existence and their RAM types on a website somewhere, I can understand why it doesn't exist...
kerneljack

Wow, that's exactly what I was going to suggest, as I read the first 2 paragraphs :-)

I recently needed to get more ram for a server at home so I did the requisite "open up case, find motherboard model no" stuff, went to the taiwanese site (asus) and got the manual, found the type of ram, then went to crucial.com to find out they had a nice scanner for it already! I was on linux though, but it was a good find, nonetheless.

Senji

Unfortunately it really is that hard. I suspect that Crucial would be willing to work with someone who wanted to produce a Linux version of their Windows code though (so long as it ended up redirecting you to Crucial's website :)).

Jonathon

On my Ubuntu system there is a command line utility called lshw that is installed by default and reports information about hardware. Included in its output is much information about memory (current capacity, maximum capacity, number of used/unused memory banks, etc). If I were you, I'd take a look at its source code to see how it obtains this information. Good luck with it.

sil

Jonathon: that would be a great idea, except mine says this:

*-memory

description: System memory

physical id: 0

size: 894MB

and that's it for memory. So...perhaps the information's not available on all machines :(

Bastien Nocera

Either:

1. Buy brand hardware, crucial and kingston can get you the right memory without a problem

2. Check the output of dmidecode, it looks something like:

Handle 0x1100, DMI type 17, 27 bytes.

Memory Device

Array Handle: 0x1000

Error Information Handle: Not Provided

Total Width: 64 bits

Data Width: 64 bits

Size: 1024 MB

Form Factor: DIMM

Set: None

Locator: DIMM_1

Bank Locator: Not Specified

Type: DDR

Type Detail: Synchronous

Speed: 533 MHz (1.9 ns)

Manufacturer: 2CFFFFFFFFFFFFFF

Serial Number: 7540A144

Asset Tag: Not Specified

Part Number: 16HTF12864AY-53EB1

Voila!

Dave Morley

There is a tool it is free and available and precompiled for use on "the ultimate boot cd" also on the Linux "Gentoo based System Rescue CD" the tool is called "aida" and I think maybe available on Knoppix also.

This basically tells you pretty much everything that the bios can tell you about the stuff on and plugged into your mother board. As a side note it doesn't always get the sound card name correct but I think that is about the only thing it gets wrong.

sil

Ahaha, dmidecode. Nice. I shall take a glance at that.

mrben

I'm so glad I'm not the only one who has this problem. It has always confused me. Let me know when you finish writing the program ;)

sil

Grr! The Crucial website doesn't work properly in the Firefox I have here when you try and buy stuff.

sil

Ah, hm. It now says "Crucial.com is undergoing scheduled system maintenance. The website is currently down for scheduled maintenance. Please check back soon."

So it may not be Firefox :)

Jan Wikholm

Thanks to Jonathon for posting that info about the 'lshw' command! I did not know of its existance and it now solved my issues. THANKS!

ruben

great, with ubuntu

sudo lshw

or

sudo dmidecode

are perfect, thank you guys :-)

Alex

Thanks for the info! For what it's worth, dmidecode works great with Redhat Enterprise Linux 3 (RHEL3), too.

Paul

Thanks for the dmidecode info. I was trying to figure out how many RAM banks i had in a co-located rack server that i absolutely could not shut down.

Tony

Thanks Bastien Nocera - dmidecode was exactly what I needed :)

Works great on CENTOS 4.3

Frank

Just what I was looking for....

Worked on CentOS, Ubuntu, and Mandrake

MJR/blog: Software

[...] I'm pondering adding more RAM to my workstation. 128Mb is enough for most of my work, but OpenOffice swaps a lot. I couldn't remember what RAM is currently in it (one stick or two?) so I was very happy to find dmidecode in the comments on as days pass by, by Stuart Langridge: Memory scanner for Linux. dmidecode says I have a free slot and another 512Mb stick is surprisingly cheap. Actually, whole Ubuntu-ready-to-use computers are surprisingly cheap, according to lkcl. I hope they don't contain toxic e-waste. I must be getting old. [Antti-Juhani Kaijanaho] [...]

How much memory is in my Linux system? | Steve Glendinning

[...] Thanks to MJ Ray and Stuart Langridge, hopefully this will save me getting the screwdriver out in future! [...]

Jon

Thanks a lot! dmidecode is just perfect on CentOS 5 on my laptop! I upgraded my Dell Inspiron 500m from 512 to 1024 Mb, but there's errors on one of the blocks, so now I again run on 512. :-(

Well, what I was actually searching for was a tool that could scan the RAM-block - and possible map out bad-blocks like on harddisks - if there's any such thing possible.

But then I instead - at last - got another problem solved instead - with dmidecode: What is the max amount of RAM, my laptop can handle? Some say 1GB, some 2GB - even Dell's own homepage conflicts on this issue (and with the manual)! Thanks again! Just added "dmidecode" to my "Special Linux Commands" doc. :-)

cw

lshw and dmidecode to odd things on older boards, like list a 32MB pc100 as:

Installed Size: 16 MB (Double-bank Connection)

and also list it 2 times, and a 128MB as:

Installed Size: 64 MB (Double-bank Connection)

but does not list it 2 times.

and Jon, as for remapping like HDD's, no such thing, but memtest86 can help you verify that the ram is indeed the issue. Supposedly DDR3 will support something similar to this, as does ECC ram.

Kevvy

Works for opensuse 10.3 . Using "dmidecode --type memory" limits the output. Not entirely sure it tells me exactly what I should order however...

Tim

You guys rule. That `sudo dmidecode' command in my Ubuntu Linux box did the trick.. I now know much more about my hardware than I ever cared or wanted to. Good stuff. :)

Bill

How do you get to the command line to type "sudo dmidecode" or sudo lshw? I'm new to Ubuntu.

sil

Bill: in the Applications menu, go to Accessories, then Terminal.

jr2

"Crucial.com is undergoing scheduled system maintenance"? Clear your cookies. Oops, now it's not. Apparently if you visit crucial too many times they send you away. Or, their maintenance cookie is very flawed.

Found this out after using Google Chrome's incognito mode and noticing that crucial.com now loaded, whereas it wouldn't in normal browsing mode. Cleared my cookies, and it now works! Have done this twice now with success.

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.