Formatted micro SDHC card but partitions and files remain

Solution 1:

Big Sur (macOS 11.1) seams to have problems dealing the FDisk_partition_scheme when the Extended DOS partition is not the 4th entry in the Master Boot Record (MBR) partition table.

The OP tried to use various forms of the diskutil command to erase the current partitioning. Also, the OP tried using the dd command to overwrite the MBR table with zeros. Both diskutil and dd commands require exclusive access to disk4 before making changes. Evidently, this fails to happen.

The fdisk command will work with shared access. One possible solution would be to use the following to erase all the partitions.

echo "erase\nq\ny" | sudo fdisk -e /dev/disk4

Another possible solution would be to use the following to create a single FAT32 formatted volume.

echo "auto dos\nq\ny" | sudo fdisk -e /dev/disk4
sudo newfs_msdos -F 32 -v MYSDCARD /dev/disk4s1
diskutil mount disk4s1

Note: I have observed the mountdisk verb of diskutil command does not always mount all mountable and UI-browsable volumes on the given partition map.