Use external storage for Nextcloud VM

, ,

Hello Folks,

the official Nextcloud VM seems like an nice and good method on getting Nextcloud to run.

The appliance is utilizing two virtual hard drives:

  • sda mounted to /
  • sdb (zfs) mounted to /mnt/ncdata

I want to mount /mnt/ncdata from an external storage. Preferred as smb. Other methods as nfs or iscsi are also possible.

As a background - I have a small home sever with esxi and a couple of VMs that use freenas/truenas as the storage.

Is there a recommendation on how to set /mnt/ncdata to an external storage before the installation is running.

I had been looking at the documentation, but can not find a recommendation there.

Thank you for helping!

This is more so a Linux/VMware question than a Nextcloud question. It’s been a long time since I looked at the premade VMs. If it has a separate data disk already then you could relocate the VMDK prior to first boot.

You mentioned wanting to mount remote storage to /ncdata directly by the VM. To do this you will have to stop services (web server, database, etc.), move the data taking special care to keep permissions intact (which may present a problem with SMB), and then remount it and modify /etc/fstab accordingly.

The “problem” with the supplied official VMs is, that most of the configuration is already done and on there is already data on the /mnt/ncdata folder.

But a working method seems to set up the VM from scratch on your own and then let the actual set-up script get to work:

Build your own Nextcloud VM - see section 5 “Installation Step-by-Step”

Of course before I let the script run, I already mounted my external storage under /mnt/ncdata

Still seems to be working better for me, than setting up everything manually.

You could also use a pre-made vm, mount a smb storage to the vm, copy all files from /mnt/ncdata to the smb storage, unmount the /mnt/ncdata dirextory, remove the virtual drive from the VM and mount the smb storage instead in /mnt/ncdata (of course with correct permissions). This is at least one way how you could do it.

Yes, one could move all the data and associated files.
I am a little concerned here, since it seems to involve more steps and has its problems (maybe).

e.g.:
https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170

This is only as complicated if the instance is already in production. If you just set it up, only the steps I mentioned are needed.