How do you specify a directory where IPFs is used to store user data?

I want to know the big guys who can give me directions. Thank you very much!

It’s there in the blocks directory, sharded into all those subdirectories. Use du -hs | sort -h to find the biggest ones. Also, running a beta-quality network service as root is just begging to get hacked.

How to specify the storage directory? For example, I want him to store on a hard disk I have newly mounted. How do I do it?

Hi jack1,

With go-ipfs you get and set configuration maybe you see around repo-path value.


Another way is to move the blocks directory and symlink it. Make sure to stop ipfs daemon, then

mv ~/.ipfs/blocks /mnt/storage/ipfs-blocks
ln -s /mnt/storage/ipfs-blocks ~/.ipfs/blocks

You can change the default directory for all things IPFS using the environment variable IPFS_PATH

For example, on all my IPFS nodes I configure them like this:

export IPFS_PATH=/ipfs
ipfs init  --profile=server,badgerds

The above will then set the directory for IPFS cofig, repo, keystore, etcc to /ipfs/....
Keep in mind, if you unset the environment variale, and then attempt to run ipfs daemon you will get an error similar to Error: no IPFS repo found in _yourhomedirectory_ so if using a non-default IPFS directory you will always need to make sure IPFS_PATH is set. The best way to do this is by putting an entry int your .bashrc file or other similar profile file.