How to install and store data files on network drive?

Hey all,

I’ll start by explaining what I’m trying to do: I film and edit video with a group of people and need to have a way to share files between us. We aren’t close enough together to just share memory cards or drives. We have a Windows Server setup with about 100TB of SAN storage. We’re committed to leaving the storage as a large volume shared by Windows. What’s the best way to deal with this with Nextcloud?

This is where I’m at so far. I’ve set up Nextcloud in a VM, which worked well, and want to have it store its data file directory on a SMB network drive. I can’t have the files sealed away in a VM drive, I need access to them. Any duplication will cost us space we can’t afford, so having copies on the VM and copying them out to another share is out of the question, too. Moving them is also not an option, the group needs to access the files as well.

I installed Nextcloud from a Snap package and just realised I can’t even make use of the External Files app as SMB isn’t even supported via that method. Before I go on a trip down memory lane doing a manual LAMP stack install to try and get around this, can anyone please tell me if there is a better way to approach the problem?

Even if I can get the External Storage app working, it’s not ideal. The ‘private files first’ design approach to storage is going to be confusing for the group who would have to make sure to upload everything into the shared folder and not their home directories, and if they get it wrong it’ll be a hassle for me to help them fix - I don’t want to be logging into a Linux CLI ever, if I can help it. It’s probably great for sharing documents with strangers, but collaborate with a team seems really challenging with Nextcloud.

Is the way Nextcloud Enterprise works any different?

Thanks all

Hello,

Personally, I think Windows SMB share option is the fastest & easiest way with your workflow.

Just for discussion purpose, you can very easily access external drive (Network or Host) out from VM (Ubuntu) and set that as NextCloud Snap Storage drive.

Step 1 - Network Prep

VM Network must be on external, where VM obtains IP or rather stays on your routers physical IP range (Subnet) → VMWare calls it Bridge Mode, Hyper-V calls it External virtual Switch

Step 2 - Network Share Prep

Create a normal user in Windows with password. Share that big HDD of yours via that user account with a share name, like for ex. 100TB. Ensure the share is working by accessing it via other LAN connection system using that newly created network user account.

Step 3 - Network Drive Mount

In your Ubuntu VM, under home and your user directory (like /home/your_user, running following commands,

  1. sudo mkdir pw then cd pw
  2. sudo nano WinShare → This will open up CLI text editor, there create two lines exactly like this,
username=Win_User-Name
password=your_password
  1. press CTRL+X, then type Y, then press Enter → This will save that file.
  2. Run command, sudo apt install cifs-utils -y
  3. Run command, sudo mkdir /media/100TB & sudo mkdir /media/100TB/ncdata → Snap nextcloud can only access /mnt or /media for external drive mount points, so I prefer creating the mount point at /media location.
  4. Run command, sudo nano /etc/fstab → This will open up a system configuration file in CLI text editor, do not change anything, just add following line as the last line of that file → //IP.Address.WinShare.Machine/share_name /media/100TB cifs vers=3.0,credentials=/home/your_ubuntu_usr_dir/pw/WinShare,file_mode=0777,dir_mode=0777 0 0
  5. press CTRL+X, then type Y, then press Enter → This will save that file.
  6. Run command mount -a → If you have done everything right, this should not generate any error and that 100TB share of yours is now accessible under /media/100TB directory in your Ubuntu VM

Step 4 - Changing the Snap NextCloud data dir

  1. First step is obviously to install Snap NextCloud
  2. Run command, sudo snap connect nextcloud:removable-media → this is to grant nextcloud snap access to removable media.
  3. Run command, sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php → This will open configuration file under CLI text editor, carefully locate and change only one line saying “datadirectory” → there change the location to /media/100TB/ncdata
  4. press CTRL+X, then type Y, then press Enter → This will save that file.
  5. run command, sudo mv /var/snap/nextcloud/common/nextcloud/data/. /media/100TB/ncdata/
  6. Run command, sudo chown -R root:root /media/100TB/ncdata & then sudo chmod 0770 /media/100TB/ncdata
  7. Restart the Ubuntu VM

If everything is done right, Ubuntu VM will host and run Snap Nextcloud but user data is going to be saved under ncdata folder of your host or even network Windows server 100TB drive.

I think the best way of accessing it is via a WebDAV Share mounted as network drive in each Windows client device. But somehow it is not working for me either.

Microsoft Community has multiple complains on this WebDAV issue but so far, no solution from MS. Refer here → Windows 11 WebDav issue with OwnCloud - Microsoft Q&A

1 Like

Dude! Thank you so much, this was a brilliant set of instructions and worked perfectly.

One minor error in your cifs config - and I did actually try exactly what you’ve done, but it failed, and I didn’t realise the error that time around hence why I was so frustrated - the share needs to be configured with file_mode=0770,dir_mode=0770 rather than file_mode=0777,dir_mode=0777, else you get an error:

Your data directory is readable by other users
Please change the permissions to 0770 so that the directory cannot be listed by other users.

That had me trying to chmod the ncdata and parent folders which of course has no effect on a Windows-hosted SMB share… Haha. It’s all working now, so again thankyou :slight_smile:

1 Like