If you use only hard objects to measure volume you will under-measure the pack: You'll measure a 40-liter pack as 35-ish liters. Or less
If you use 40 liters of loose lentils or rice, you'll get a very accurate volume, but that's a LOT of lentils (10.5 gallons).
If you combine the two techniques - rigid containers like 2-liter soda bottle, gallon milk jugs, and assorted Nalgene bottles with a few gallons or lentils, gravel or rice, you'll get an accurate measurement but minimize the amount of rice/lentils you use.
If you plan on doing this a lot, make some very floppy beanbags to hold the rice/lentils in 1-liter and 2-liter quantities to fill in the gaps around rigid containers without making a mess. Stitched out of cloth is sturdy and very flexible. A liter of rice in a gallon ziplock (burped of air) is quick and easy.
If I start one more sentence with the word "if" . . . .