How to move js-ipfs to new location?

I have a NodeJS server running a JS-IPFS, I’d like to move the ~/.jsipf repository to a new mounted drive. I’m seeing conflicting answers on google on the best way to do this. One answer says to move the .ipfs folder to its new location, then update the IPFS environment var $IPFS_PATH, but currently echo $IPFS_PATH shows that $IPFS_PATH is empty.

I’m assuming this has something to do with the fact that I’m following instructions for how to move a IPFS repo, but I’m using a JS-IPFS repo.

How should I go about moving my ~/.jsipf repository to a new mounted drive? Is it different sine I’m using JS-IPFS than it would be for a non-JS-IPFS repo?

Ok after I dug through some docker files I was able to find an answer:

Shutdown your jsipfs daemon. For me I just shut my app down.

If you already have a ~/.jsipfs folder move it:
sudo cp --recursive --verbose .jsipfs /newLocation/.jsipfs

//remove old .jsipfs folder (only if other the copy above worked 100% correctly)
rm -r .jsipfs

//chrown user be able to make changes to new folder
sudo chown -R $USER:$USER /newLocation/.jsipfs

In your JS code pass in the new location as an option:

ipfs = await IPFS.create({
	repo: '/newLocation/.jsipfs',
});

Start the app back up JS should now pull data from the new location.

1 Like