TheRemote / PiBenchmarks

Raspberry Pi benchmarking scripts featuring a storage benchmark with score
https://pibenchmarks.com
MIT License
173 stars 12 forks source link

BootDrive detection fails if ChosenPartition is not a mount point #23

Closed mhaas closed 2 years ago

mhaas commented 2 years ago

My mount looks like this:

pi@raspberrypi:~ $ mount | grep /mnt
/dev/sda8 on /mnt type ext4 (rw,relatime)

I want the Benchmark.sh script to run against a subdirectory:

sudo ./Storage.sh /mnt/benchmark

In this case, the hdparm results show as empty:

     Category                  Test                      Result     
HDParm                    Disk Read                  MB/s                    
HDParm                    Cached Disk Read           MB/s                    
DD                        Disk Write                200 MB/s                 
FIO                       4k random read            21135 IOPS (84540 KB/s)  
FIO                       4k random write           9706 IOPS (38824 KB/s)   
IOZone                    4k read                   34226 KB/s               
IOZone                    4k write                  26987 KB/s               
IOZone                    4k random read            25565 KB/s               
IOZone                    4k random write           34065 KB/s               

                          Score: 8905                                        

It seems the script does not handle the scenario where the path is not directly a mount point. This can be fixed by adding --target to findmnt to try harder to find the mount point by traversing the path:

  BootDrive=$(findmnt -n -o SOURCE --target "$ChosenPartition" | sed 's/\[\/\@\]//g')

This change is in line 342.

With this change in place:


     Category                  Test                      Result     
HDParm                    Disk Read                 308.37 MB/s              
HDParm                    Cached Disk Read          282.28 MB/s              
DD                        Disk Write                200 MB/s                 
FIO                       4k random read            20418 IOPS (81674 KB/s)  
FIO                       4k random write           9687 IOPS (38751 KB/s)   
IOZone                    4k read                   29917 KB/s               
IOZone                    4k write                  26498 KB/s               
IOZone                    4k random read            22388 KB/s               
IOZone                    4k random write           29310 KB/s               

Thanks for providing this tool!

TheRemote commented 2 years ago

Oh wow, that is a fantastic find, thanks for sharing this!

It's really hard to figure out why some of these tests fail from my end. It tries to submit whatever it's able to do but some of them are really tough. Who knows how many others have failed for this exact reason in the past.

I've implemented this change live now. Thanks again!