Unusual gen2 problem

I have a gen2 2TB My Cloud. Over time I’ve lost the Public folder in the smb.conf file. I’ve had the system reboot and not mount the /mnt/HD/HD_a2 partition. I’ve had it not mount the /mnt/HD_a4 partition. I’ve done the 40 second reset. After the 40 second reset the system appears to have been restored. Because I need to go thru the dashboard and set it back up.
During this time I have found that the smb.conf file gets recreated on every time smbcom is run. smbcom uses a file .smbm.xml to rebuild the smb.conf file. It is located in the /mnt/HD_a4/.systemfile
folder. The .smbm.xml file contains all of the shares that you have created. When smbcom runs it reads the .smbm.xml file and checks the /shares folder. If it finds a folder in the /shares that is not in the .smbm.xml it removes the folder. I’ve had all of the folders in the /shares folder removed becasue the .smbm.xml file didn’t exist. If I copy the file from my other system and rerun smbcom it rebuilds the smb.conf file with my shares.
Today I did another 40 second reset. After the reset the /mnt/HD/HD_a2 was not mounted. In fact the /mnt/HD/HD_a2 folder did not exist. I did a mkdir /mnt/HD/HD_a2 and was able to mount the data Volume. I checked the /shares folder and it was empty. I checked for the .smbm.xml file and it was missing. The My Cloud showed up under the network on file explorer. But no share were listed.
So I recreated Public ,SmartWare, and TimeMachineBackp folders in /shares. I copied the saved copy of .smbm.xml file to /nt/HD)a4/.systemfile. I mounted the data volume. Then ran smbcom. Now the windows PC can see the Public,SmartWare and Timemachinebackup folders.
What I can’t seem to find is how the data volume gets mounted. I know that /mnt/HD_a4 gets mounted first. /mnt/HD/HD_a2 should be mounted next. Looking thru system_init there is no mounts. I think hdVerify, which gets run from system_init, does the mounts. But there is no documentation on hdVerify. The same as there is no documentation on smbcom. Because this is a busybox setup.
System initialization is different than the gen1 system. I don’t know if there is no documentation because WD doesn’t know how this works or they just don’t want to say. It would be nice to know how some of these special programs work.

Problem solved. This problem occurs when you boot a gen2 with a USB drive connected
that contains the fun_plug file. This fun_plug is like a backdoor. WD does not provide any documentation about this file. It seem that the system_daemon process calls load_module to create the systemfile and start samba.
When I talked to WD about the problem of samba not being started. They moved me up to second level support. Then second level support tried to connect me with third level support. At this point I got a email from WD telling me that I should do a system restore . If that didn’t work they would RMA the device. I told them a system restore would not fix the problem. They still would not let me talk to third level support. Which caused me to spend several days tracing this problem down.
I now need to find a way to fix this with fun_plug. Maybe have fun_plug call load_module.