I have a 2009 Specialized Hardrock, with a Shimano FH-RM30 QR rear hub and a Shimano MF-TZ31 freewheel. I took apart basically the whole wheel assembly trying to repair the freewheel. Now it's a week later and I need to resassemble, but I don't recall how the axle was configured. I think I have the pieces in the right order in this photo(?), but in the middle row you can see a washer and a spacer...no idea where those would go, and my Google searches are coming up empty. I'm sure a real mechanic would know how, where and why to use those spacers, but I'm clueless. Can anyone help?
This isn't FH-RM30. It's a freewheel hub. MF-TZ31 is a freewheel and the drive side axle hardware pictured is that of a freewheel hub. Also the skewer and dust shield type (thick and inflexible) are non-Shimano.
As you indicate in the comments, the dust shield can't go over the thin spacer. So therefore the thin spacer needs to be next to the cone. The shield should be able to fit over the locknut by itself.
Always make sure the drive-side cone and locknut are torqued hard against each other before beginning reassembly.
Shimano provides all sorts of technical documents; "Exploded View" or EV documents show how all the components of a part go together and gives part numbers and names and some key dimensions. That's what you want in a situation like yours.
si.shimano.com is the technical info repository for Shimano.
Searching google for "Shimano FH-RM30 QR rear hub EV" produced the link https://si.shimano.com/pdfs/ev/EV-FH-RM30-8S-2388B.pdf among others, which is the EV for the 8-speed version; among the other links was one to an EV for the 7-speed version.