QUESTION:
How is the SD card mounted?
ANSWER:
The SD card is auto-mounted on insert by udev. Have a look at the udev rules in /etc/udev/rules.d.
QUESTION:
How do I know if it is mounted? What is the most robust procedure to determine if a SD card is present?
ANSWER:
Since the card is auto-mounted, you could read /proc/mounts to see if it is mounted or not. You could also read /sys filesystem to see if the card is present. Look at the contents of /sys/bus/mmc/devices. You should see a device link starting with “mmc0:” when the card is inserted.
QUESTION:
How do I properly unmount the SD card without risk of losing data?
ANSWER:
‘umount’ will flush all data to the card before it returns, so it is safe to remove the card after it is done. For example,
umount /dev/mmcblk0p1
Also be aware of this info on multitech.net:
http://www.multitech.net/developer/products/multiconnect-ocg/applications/improving-sd-card-performance/