Pay social insurance (unemployment) in my hometown and work in a small company in Shanghai. Will it be recorded in the personnel file?

If your file is in the unit where you work now, there may be a registration form you filled out when you went to this unit, but you didn't sign a contract, so there will be no employment record.

If your file is not in this unit, it will definitely not be recorded.

I don't know where to put your papers. If it is in a formal place such as a talent center or a social security center, it is generally not easy for people to browse. Lawyers have the right to read private files only under certain conditions, that is, cases involving parties need documents from relevant departments, otherwise they are not allowed. However, if the files are placed in other places, and some people are irresponsible and do not understand the policy, they may easily provide them to lawyers, which is another matter.