How to set up an IPFS repo

I have installed the IPFS-desktop package via snap install ipfs-desktop on an Ubuntu 18.04.4 PC, installed a 2TB drive at device /dev/sbd1 and then Ext4 formatted a single 2TB partition mounted at /media/username/HulaCLoud. I want this drive to be the IPFS repo.

I tried to look in ~/.config/IPFS Desktop/ but it didn’t exist and neither did ~/.config/Electron/config.json.

Eventually I tracked down the config to two hidden files in the SNAP .ipfs-desktop folder – IPFS_PATH which points to /home/username/snap/ipfs-desktop/17/.ipfs and IPFS_EXEC which points to /snap/ipfs-desktop/17/resources/app.asar.unpacked/node_modules/go-ipfs-dep/go-ipfs/ipfs

How do I get IPFS-desktop to use the 2TB drive as an IPFS repo?

If you’re using the IPFS Desktop app, click the icon in the taskbar and there’s a Move Repository Location link under Advanced.

Which version of IPFS Desktop app are you talking about? I am on Ubuntu and installed Revision 1b58b62 with Snap. The only icon I can see which has an “Advanced” link is “Status”, and under that Advanced link there is no “Move Repository Location”, only Gateway, API, Addresses and Public Key.

This is from ipfs-desktop v0.11.4:

I have the same issue. I would like to move my IPFS repo to /media/usb1 but I’m running headless Ubuntu so I don’t have the Desktop option. I don’t see the applicable command anywhere in the CLI commands (https://docs.ipfs.io/reference/cli/). How can I move my repository location via CLI?

https://docs.ipfs.io/how-to/move-ipfs-installation/

Thanks Hector. I didn’t have anything yet in my ~/.ipfs folder so I deleted it. Set my IPFS_PATH in /etc/environment and then re-ran ipfs init which created the repo in my media/usb1 location.

Now my only problem is that I can’t seem to assign ownership/permission to /media/usb1 to the ubuntu user. I have to do everything as root.

This was because I had used my Macbook to format the USB Drive to FAT32 which doesn’t allow for Linux permissions. I unmounted the drive (sudo umount /media/usb1). Then ran sudo mkfs.ext4 /dev/sda from my Ubuntu server to reformat it to Ext4. After that I was able to change the drive ownership to the Ubuntu user: sudo chown -R ubuntu:ubuntu /media/usb1. Now I can run ipfs init as the Ubuntu user and it used the IPFS_PATH from /etc/environment to initialize the environment on the USB Drive. This is attached to a Raspberry Pi 3 BTW. I now have the world’s shittiest IPFS node running :slight_smile:

There are a few things to remember with this particular method…

  1. USB drives mounted on /media are usually mounted through fuse. This means the USB drive is not re-mounted on OS reboot and will need to be manually mounted each boot cycle.
  2. The drive location may not always be the same… generally, UUIDs should be used instead.
  3. If you want the drive to be mounted automatically each reboot, you should place the UUID in /etc/fstab… with a mount point probably in /mnt instead of /media
  4. To traverse a directory tree, the execute permission on all lower directories needs to be set for the target user.

Yes, good point @ipfsme. I forgot to mention that I’m using https://github.com/rbrito/usbmount which auto-mounts to the first available usb port so I can (should) count on it being at /media/usb1 on reboot.