Configuring RAM Drive

The SQLite database that we are using for distributing CAN messages for the applications running on Raspberry Pi will be stored in memory (RAM-Drive).

RAM drive is very good alternative to SD card because

  1. RAM is MUCH faster then SD card
  2. The SD card will not wear out as fast
  3. We don’t need data persistence. What we need to store will be stored by FDR application in CSV format on SD card.

Creating the RAM-resident mount point for SQLite DB:

Create the /memdb directory:

sudo mkdir /memdb

Edit the fstab file:

sudo nano /etc/fstab

add the following line at the end of the file

tmpfs /memdb tmpfs defaults,noatime,nosuid,size=10m 0 0

Save and close the file and run the following command

sudo mount -a

Check if mount point is created

df -h

One of the line in the list of mount points should look like this:

tmpfs 10M 76K 10M 1% /memdb

That is all, folks! 🙂