I am using a SSD connected to a Mac over a sata to usb bridge to archive relatively big files. After I transfer it to the SSD, I unmount it and and unplug it.
This SSD has a DRAM cache. From my understanding, this cache is both used to cache writes and store a copy of the file mapping. If I unplug it without unmounting or when its currently writing, I would assume that it would be very possible to lose data that is cached in DRAM and maybe even lose files due to pointers to any data that changed in the mapping being lost as well.
My question is: If I unmount the drive and immediately unplug after it successfully unmounts, is there a chance that I remove power from the SSD prior to it finishing writing whatever is in the DRAM to disk?
Does the OS / APFS manage the DRAM and ensures that its flushed prior to it being unmounted or does the firmware in the SSD do this?