IPFS: How to relocate /home/.ipfs/blocks folder

This folder can become enormous as you increase the number of files pinned with ipfs-desktop.

On GNU+Linux with the ipfs-desktop appimage, what is the best way to have this folder set to a different location / on a different drive?

Stop IPFS.
Move your folder to wherever you want.
Create a symbolic link like so: ln -s /your/new/path/to/blocks ~/.ipfs/blocks
Start IPFS.

That should be pretty much it.

An alternative way is to use use mounting where you can still put your folder wherever you want. You’d just get a “mount bind” (more info here). I’d just go for the link way as that’s much easier in my opinion.

Note that linking is persistent (aka, it survives a reboot). Mounting isn’t unless you modify fstab to make it persistent.



ipfs-desktop ought to support making this change using the GUI. That should be included in its next update. It ought to be possible to do this without needing a symbolic link. Also, when ipfs-desktop first launches, the user ought to be prompted where this (potentially large) folder will be stored. It would probably be best to move the whole .ipfs folder to keep things together.

Glad it worked :slight_smile:

You can change it another way too. One that doesn’t require the link at all (and not a mount either).
Have you read the readme from here: go-ipfs/README.md at master · ipfs/go-ipfs · GitHub?
I didn’t, but i just found this part:

  ipfs uses a repository in the local file system. By default, the repo is located at
  ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable:

    export IPFS_PATH=/path/to/ipfsrepo

So you can set the IPFS_PATH environment variable in linux. The best way to do that is a bit different between linux distributions so i leave it up to you to figure out the way that works for you.

Once you’ve set the path, you can just remove that symbolic link. You can do that using rm <link> but to have a more “safe feeling” (as rm can remove anything) you can also use unlink <link> which only works on symbolic links.


For reference, the procedure is documented: https://docs.ipfs.io/how-to/move-ipfs-installation/