Ipfs node data migration

The ipfs that I set up store a lot of data, but there is a problem with my program, and I need to reinstall ipfs. How can I reduce the data stored in the ipfs node and migrate it together?

When I understand you correctly you want to copy the .ipfs folder from one installation to a new one, right?

You can always run ā€˜ipfs repo gcā€™ to remove all non-pinned content from your clientā€™s cache.

If your ipfs doesnā€™t start anymore you can still backup the folder somewhere and move it to your new installation.

Yes, can you elaborate? Or give a relevant link?
No need to execute: ā€œipfs initā€? In this way, can the previous ipfs id remain unchanged?

Iā€™m not exactly sure where the problem lays. Just copy the .ipfs folder as a whole from one installation to a different one.

Your private key is saved in the config file, the status of pins etc is stored in the database and all blocks you are currently caching are in ~/.ipfs/blocks/.

You cannot reduce the size of blocks without running ipfs, since the garbage collector needs to read the status from the database and compare it to your blocks to filter out everything you need to hold.