SD cards can contain a vast amount of data. Sometimes the only instance of a file or application may be found on the SD card. Application information found on the SD cards  may be encrypted as discussed in section 1. Most of the data stored on the SD and emulated storage are stored in the external.db file in the /USERDATA/data/com.android.providers.media file. This file remains persistent even if the SD card is removed. This means that files and filenames associated with SD cards previously in the device can be recovered and examined. This is a great way to tie an SD card back to a device!  Keep in mind that the external.db is found on the device, not the SD card, which means traces are left behind, even if the card is removed.

Location of the external.db changed in Android 11 and 12 due to it being included in Project Mainline1. The path for these versions are:

  •  Pixel (vanilla Android):  /USERDATA/data/com.google.android.providers.media.module/ 

  •  Samsung:  /USERDATA/data/com.android.providers.media.module/ 

A great reference is a blog written by Josh Hickman https://thebinaryhick.blog/2020/10/19/androids-external-db-everything-old-is-new-again/.

Reference:

[1] https://for585.com/mainline - Project Mainline Reference