Use second LAN computer for storage

Ubuntu Server 22.04.5 with KDE on top. I have Nextcloud running on one machine. It is fine. I want to add a raid as the data director/primary storage but the RAID will be on a different machine on the LAN. How do I configure NextCloud to do that. I do not want “External Storage”. I just want the data directory running on a different machine.

Hi @walttheboss,

Theoretically, you can move your Nextcloud data directory to any file system that can be automatically mounted using fstab. This can be done either at the file system level or at the block device level.

File System Level:

Examples of sharing at the file system level are NFS, SMB/CIFS, SSHFS, GlusterFS, and CephFS. In my opinion, NFS would be best suited for your case. With NFS, the file system is created and shared on the NFS server (where your RAID physically resides). The NFS client (in this case, the Nextcloud server) mounts this remote file system as if it were a local directory, which makes it a good candidate for your setup.

You mentioned that you don’t want to use the “External Storage” feature of Nextcloud. This is important to clarify, as “External Storage” is designed to handle network disconnections gracefully. If the external storage becomes temporarily unavailable, Nextcloud can still function without crashing or corrupting data, and it will retry access when the storage becomes available again.

However, when you move the primary data directory to a remote file system (such as an NFS mount), Nextcloud does not have the same built-in mechanisms to handle network outages. If the network connection to the NFS server breaks, Nextcloud may encounter severe issues, such as:

  • Files becoming temporarily inaccessible.
  • Potential data corruption, if writes are interrupted.
  • Database inconsistencies due to sudden disconnections during file operations.

These issues are particularly dangerous in a production environment, as Nextcloud expects the primary data directory to always be available.

Block Device Level:

Alternatively, you can configure the data directory at the block level using technologies like iSCSI. iSCSI allows you to “loan” a block device (e.g., a partition) from the server (iSCSI target) to the client (iSCSI initiator). The client (Nextcloud server) accesses the block device directly and creates its own file system (e.g., ext4, XFS) on it. From the Nextcloud server’s perspective, the storage behaves like a local hard disk, but the physical storage resides on the iSCSI server.

In this case, the Nextcloud server manages the file system entirely, and the iSCSI server only provides the raw block storage. While this approach can offer more control and potentially fewer issues with file-level network disruptions, it still carries the risk of data loss if the iSCSI connection is interrupted.


So both, file system-level and block-level approaches can work, but each has its own risks and trade-offs. While NFS is easier to set up and manage, network reliability is crucial to avoid issues.
External Storage exists for a reason: it’s designed to handle the kinds of temporary network disconnections that would otherwise cause problems if used for the primary data directory. iSCSI can offer a more stable solution, but even here, network issues can cause serious problems.

I would recommend testing your configuration thoroughly, especially if this is intended for a production environment, to ensure that data integrity and performance are up to your standards.


Much and good luck,
ernolf

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.