Unable to start containers after reinstalling the OS

This sounds similar to Restoring LXD Config on New Host

The recommend way to restore LXD using an existing storage pool is to use the lxd recover command.

See Backing up a LXD server - LXD documentation