Export IPFS_PATH not working

I am trying to find a way to make IPFS more practical for me. My main OS is ubuntu 16.04 and it is on a 120 gb SSD. In my home network I have a server that I use for storage that has 21 TB on it. I would like to configure IPFS to use my network storage to save the files I add with "ipfs add " so I don’t fill up my SSD. Reading into the documentation it says the following towards the bottom after running “ipfs --help” from the command line.

Use 'ipfs <command> --help' to learn more about each command.
  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

In zsh I have set the IPFS_PATH variable in my .zshrc file with the following entry

export IPFS_PATH=/media/network_storage/FTP/ipfs

when I run


it returns


Now, when I go to initalize ipfs the following happens (there is no ~/.ipfs directory and the /media/net/ftp/ipfs directory is empty as well)

initializing IPFS node at /media/network_storage/FTP/ipfs
generating 2048-bit RSA keypair...done
peer identity: Qma2soquUqaxZ3RmJp5QpC3GrbTtykywuhmbkcT8tW41F7
Error: open /media/network_storage/FTP/ipfs/blocks/_README: permission denied

when I run “tree” on my $IPFS_PATH I get the following:

├── blocks
│   ├── _README
│   └── SHARDING
├── config
├── datastore_spec
└── version

if I remove the $IPFS_PATH from my .zshrc and start a new shell and run “ipfs init” there is no issue initializing ipfs. The ipfs folder is created at “~/.ipfs” and it contains the following

├── blocks
│   ├── 2H
│   ├── 7J
│   ├── 7R
│   ├── B5
│   ├── IL
│   ├── JN
│   ├── L5
│   ├── LG
│   ├── N2
│   ├── OO
│   ├── PM
│   ├── QV
│   ├── R3
│   ├── _README
│   ├── SH
│   ├── SHARDING
│   └── X3
├── config
├── datastore
│   ├── 000002.ldb
│   ├── 000003.log
│   ├── CURRENT
│   ├── LOCK
│   ├── LOG
│   └── MANIFEST-000004
├── datastore_spec
├── keystore
└── version

The way I mount my network storage is with this line in my /etc/fstab

// /media/network_storage cifs uid=1000,gid=1000,credentials=/home/USER_NAME/.network_pw,iocharset=utf8 0 0

It looks as if when trying to initialize IPFS over my network something happens where it is not able to create the datastore directory and the directories and files under ~/.ipfs/blocks

I have also tried to use symoblic links with no luck either. The only thing I can think of is the line under ipfs --help that says “ipfs uses a repository in the local file system”. Does this really mean that I can only set up my IPFS path under the local file system? If there is no way for me to change where the file blocks are stored?If so that is a really big deal killer for me since I wont have much space to add files on my small SSD while I have terrabytes available to use.

If anybody sees what I am doing wrong, or has any ideas please let me know. I would really like to figure this out and I am stuck.

If you really have write permissions to /media/network_storage/FTP/ipfs it should work, so this is probably a bug. IPFS_PATH can be set to anything you can write to, NFS and other network storage should work, we’re using NFS ourselves for Jenkins. You should create a new issue in https://github.com/ipfs/go-ipfs outlining as many details as you can.

What’s your use case?

Is there something preventing you from running go-ipfs on your server with 21TB of storage and then using go-ipfs on your laptop to access the content on your server? If you set up automatic garbage collection on your laptop it will help prevent the IPFS repo on your laptop from getting too large.

1 Like

I am just using IPFS as a hobbyist/interested in the technology. I have been sharing files and folders with friends until today when my SSD filled up from data I was storing with IPFS. My idea scenario would be using my desktop with my 120 GB SSD and being able to add files without it filling up SSD.

For example lets say I wanted to send my friend a copy of my ubuntu-16.04-server.iso because I think I can send it faster over my internet connection and to help spread the gospel of IPFS. My ideal scenario would be to run the following command from my OS that is on my SSD

ipfs add /media/network_storage/FTP/linux_isos/ubuntu-16.04-server.iso

but instead of having the files stored on my SSD, having it stored on my server so my SSD doesnt fill up.

I guess I could just install go-ipfs on my file server, but from my knowledge I would first have to ssh into my server, then add the file using ipfs, then copy the hash and send it. I guess that is doable, but sticking to my ssd would be more convenient. I guess maximum laziness is my goal.

If you’re mostly using your laptop to serve up files from your server’s CIFS share, you could also keep the IPFS path on your laptop and add whatever you want from your CIFS share using the filestore (with ipfs add --nocopy <file>). This doesn’t store the bulk of the content on your laptop (or duplicate files stored on your server), doesn’t require ssh-ing into your server, and still lets you access your server data over your CIFS share.

I think there’s a planned feature to allow you to download files into the filestore, but I haven’t checked on that in a little while.

1 Like

Ok so I have tried filestore and this is what I got

:~ `echo "this is a test" > /media/network_storage/FTP/ipfs/test.txt` :~ ipfs add --nocopy /media/network_storage/FTP/ipfs/test.txt
Error: filestore is not enabled, see https://git.io/vNItf
:~ `ipfs config --json Experimental.FilestoreEnabled true` :~ ipfs add --nocopy /media/network_storage/FTP/ipfs/test.txt
15 B / 15 B [=============================================================================================] 100.00% 0s Error: cannot add filestore references outside ipfs root (/home/beard)
:~ `echo "this is a test" > /home/beard/test.txt` :~ ipfs add --nocopy /home/beard/test.txt
added zb2rhgS5tGbeKMPe5R3iB3Ws2u7JY5XsMwH3p4JHxWLucQ6ad test.txt
:~$ ipfs add /home/beard/test.txt
added QmYi7wrRFKVCcTB56A6Pep2j31Q5mHfmmu21RzHXu25RVR test.txt

If I go to ipfs.io/ipfs/zb2rh… Nothing happens.
If I go to ipfs.io/ipfs/QmYi7… It works.

So it looks like 1) I could not add anything of my user root (so I can’t access files on my server), and 2) at the moment it looks like it is not working (for me at least unless I messed something up)

Did you try mounting the CIFS share in the ipfs root on your laptop? I think that should work as far as IPFS is concerned but I don’t have a CIFS share handy to test with.

I’m not sure why that would be. Both links currently work for me.

1 Like

I have to say…you are one smart dude.

I mounted my CIFS share within the ~/.ipfs directory and I can access it and add files now without issue. I also tried both links again and both are working for me. The reason I though the first link (zb2rh…) didn’t work is that I put it in my browser, waited 2 minutes and it didn’t show up. I then added the same file normally and put it into my browser (QmYi7) and it showed up almost immediatly and the first link had still not shown up. I guess it just took a long time for it to propagate and be found.

Thank you for taking the time to help me with this problem. It seems like this is the ideal workaround for me at the moment and fills the solution I am looking for. I am still curious why I was having issues with the $IPFS_PATH way so I created a issue on the github. Hopefully I will be able to figure it out and help fix a bug. Here is a link for posterity


1 Like

Glad that works for you. While mounting it in .ipfs obviously works, I think anywhere within one directory up from your IPFS path (so anywhere beneath your home folder with the default of ~/.ipfs) should work too – in case the .ipfs directory is an awkward mount point.