I have tried to change again the name of the host to b.domain.com.
No luck.
It seems that when I use the old name it works (but now I am suspecting that it is getting images and things from the old server that is still online, as I get new posts and notifications from new posts in the old server, even if I have changed the IP for a.domain.com in my hosts file).
I have followed the instructions in this post to change the name of the host
I had thought that making the discourse remap a.domain.com to b.domain.com would solve the problem.
Even I have made the rake postes:rebake, but the result is the same.
I have lost the avatars and the logo and the images inserted in posts are lost too.
Finally, as @neounix suggested, I untar all the uploads again to replace the destionation in shared/standalone/uploads/ but with no luck, results are the same.