Please note that this question is related to IPFS (https://ipfs.io).
Is it possible to mount
~/.ipfs folder to an external device (such as: hard-disk, network drive, WD My book etc.)? This will help to share
~/.ipfs folder between different nodes. I was not sure that IPFS is designed to have that file system shared between nodes (simultaneously?).
Please note that I am mounting into my WD My book External Hard Drive (https://www.wdc.com/products/wd-recertified/my-book.html , File system NTFS). Please see my mounting line of code:
$ mkdir /mnt/cifs $ sudo mount -t cifs //server-name/share-name /mnt/cifs -o \ username=admin,password=my_password,uid=1000 $ mount | grep 'cifs’ //server-name/share-name on /mnt/cifs type cifs (rw)
After I have mount
~/.ipfs folder, when I try to run
ipfs init or
ipfs add <filename>, I have faced with the following error:
Error: fsync: invalid argument
ipfs add <filename> runs, it creates block files inside created folders as follows:
~/.ipfs/blocks$ ls CIQA2 CIQBE CIQCP CIQDV CIQF7 CIQGF CIQHL CIQIY CIQK5 CIQLB CIQMG CIQNM CIQOR CIQA3 CIQBF CIQCQ CIQDW CIQFA CIQGG CIQHM CIQIZ CIQK6 CIQLC CIQMH CIQNN CIQOS CIQA4 CIQBG CIQCR CIQDX CIQFB CIQGH CIQHN CIQJ2 CIQK7 CIQLD CIQMI CIQNO CIQOU
ipfs init is executed, only one file is created under each created folder.
$ ~/.ipfs/blocks$ ls */ /home/.ipfs/blocks/CIQMJ: CIQMJCAMEI4UXBQ35CUDVVJOGU3DNWNHI7O7JCWHWNMUWPGKPOTLFYY.data //coming from mounted device. /home/.ipfs/blocks/CIQMK: CIQMKGZXBKZV262ZN6ABE4SUO5BNGKVSPTGAQXSOC35UUK7FUPIIAIY.data //coming from mounted device.
Further, after running
ipfs add <filename> a new folder is created with a file inside. I have mounted that folder to my external device, it fixes the error I was facing with.
ipfs add <filename> adds a new block file into a already created folder under ~/.ipfs/blocks => it gives the same error:
Error: fsync: invalid argument.
/home/.ipfs/blocks/CIQMI: CIQMI5TLEXEWEYC3G3WELU6ONMKNLAF6CZUXU5BTWEU453LHPTUNNEI.data //coming from mounted device. CIQMIRQGFPT23SZ6XYFFU45GLZENEWRYI7PR3YJ7EP7ZC6I4ME7GPFQ.data //newly added file
The script I have write to test:
ipfs init only one time following script is executed.
$ sudo mount -t cifs //server-name/share-name /mnt/cifs -o username=admin,password=my_password,uid=1000 $ ipfs init $ cd ~/.ipfs/blocks/ for d in */ ; do if [ ! -d /mnt/cifs/$d ]; then mkdir /mnt/cifs/$d cp $d/* /mnt/cifs/$d/ fi done
To revert the files from external device before running:
ipfs add <filename>: Now all the folders inside ~/.ipfs/blocks/ actually mounted to my external device.
sudo mount -t cifs //<ip_address>/mybloc/ ~/.ipfs/blocks/ -o username=admin,password=my_password,uid=1000
Thank you for your valuable help and time.