Unable to initialize / hot swap sd card during run time

Hi

I have a system which needs to be run for 10days continuously. I have and SD card to log data during this period.

I need to verify the SD card data in between, so I send data from Bluetooth to alert my system that i am going to unmount and remove my SD card and also for mounting the SD card after I insert it back to SD card slot.

The cards gets detected easily and is accessible during initialization. 

int res = fs_unmount(&mp); is the command I use for mounting and detecting the sd card.
But after hot swap the SD card card gets detected but fails to respond due to sd card read timeout error. Kindly provide any suggestion so that I can effectively swap SD cards during runtime.
below is the snippet of the overlay file.
&spi4 {
    status ="okay";
    cs-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>,<&gpio1 12 GPIO_ACTIVE_LOW>;

    sdhc0: sdhc@0 {
       
        compatible = "zephyr,sdhc-spi-slot";
        reg = <0>;
        status = "okay";
        mmc {
            compatible = "zephyr,sdmmc-disk";
            status = "okay";
        };
        spi-max-frequency = < 24000000 >;
   
    };
Related