How to re-install HA while data is on separate data disk

You can navigate to Settings → System → Backups
and create a full backup of your configuration, addons and integrations. You have to take the backup file from the sd card before formatting it, with a program like WinSCP
Otherwise, you can install and configure the Home Assistant Google Drive Backup addon so you will be able to download backups from your Google Drive (the easiest way)

So, after reinstalling home assistant, restore the backup you have. Instructions here: How to restore a backup - Community Guides - Home Assistant Community (home-assistant.io)