Bitcoin core datadir over NFS I am going to run a bitcoin core on a Linux server (Ubuntu 20.04). I don't have enough storage to store blockchain data. Therefore, I want to save the data over an NFS server (CentOS release 6.10). However, I get an error when I set the -datadir to the shared folder.
The content of /etc/exports file in the NFS server (I've seen the configuration from here):
/home/storage/  BITCOIN.CORE_IP(rw,sync,no_root_squash,no_subtree_check)

I mounted the remote shared directory in the Ubuntu 20.04 Linux server using the following command:
mount NFS_SERVER_IP:/home/storage/ /root/blockchain/

everything works fine, and the file system disk space usage report is: (df -h)
Filesystem                   Size  Used Avail Use% Mounted on
NFS_SERVER_IP:/home/storage/  1.0T  682M  1.0T   1% /root/blockchain

After running the following command to change the data directory to the shared directory:
./bitcoin-0.20.0/bin/bitcoind -datadir=/root/blockchain

I get the following error:
Error: Cannot obtain a lock on data directory /root/blockchain. Bitcoin Core is probably already running.

I should note that the shared directory is empty before running the bitcoind, then after that, it contains an empty file, which name is .lock. Moreover, If I set the -datadir to any local folder, it will not return any error!
Thanks.
In my view, we cannot move LevelDB index files such as chainstate, etc. to an external slow storage.
According to this link, we should only move the blkxxxxx.dat and revxxxxx.dat files to an external storage. These files are inside ${datadir}/blocks/ by default. Since the index directory (${datadir}/blocks/index) contains high i/o-frequency LevelDB index files, moving it to an external storage will increase the initial blockchain synchronization time.
So take the following steps (I followed the instructions of the link):

run bitcoind.


Let it run for a few minutes, or long enough that it has started synchronizing [ref]


Then kill the bitcoind.

Next, Move the &quot;index&quot; folder up one level (so that it may remain on the local storage):


mv -f ~/.bitcoin/blocks/index ~/.bitcoin/


Move the blocks folder to the shared directory:

mv -f ~/.bitcoin/blocks ~/blockchain/


Create a symbolic (soft) link to the local index directory at blocks directory in the shared storage (use absolute path):

ln -s /root/.bitcoin/index /root/blockchain/blocks/index


Now, create a symbolic (soft) link to the blocks directory at .bitcoin in the local storage (again use absolute path)::

ln -s /root/blockchain/blocks/ /root/.bitcoin/blocks