Cloning a IPFS instance and give it a new identify

I am interested in cloning a “.ipfs” directory with all content (included cached and pinned files), copy it to a new machine, change its “ipfs id” identity and serve content.

Basically, I am cloning microSD cards with a primed “.ipfs” cache and I want the new raspberry PI to reuse that content but having a new IPFS personality.

Would it be enough to change “Identity/PeerID” and “Identity/PrivKey”?. Are there fingerprints of the old identity somewhere in the “.ipfs” directory/database?

If I am right, I would do a “ipfs init” in a different directory and then I would simply replace “Identity/PeerID” and “Identity/PrivKey” in “.ipfs/config”.

Please, let me know if my approach would work or, if faulty, please, provide some details.

Thanks.

yes, that’s enough.

If you prefer you can also generate keys with https://github.com/whyrusleeping/ipfs-key:

ipfs-key -type=ed25519 | base64 -w 0

(that gives an ID an a the private key).

The new IPFS version (from this morning) have added a key utility :

// On your new host
ipfs key rotate -o my-old-key -t ed25519
// Maybe also checkout
ipfs key --help