Nextcloud install on external data folder fails

I’m very new to Linux and so my DietPi runs in a VirtualBox environment (on an SSD) and I’m very happy about it, but have trouble getting Nextcloud to work on a shared drive:

  • I have mounted the hard drive for the data via the “Drive_Manager” and appear to be able to read and write from/to it. The drive is mounted as “/mnt/recent/” and I created a subdirectory “dietpi” where everything data-related so supposed to go in the future.
  • I have edited the “/boot/dietpi.txt” entry for Nextcloud:
  • The following error:

Can’t create or write into the data directory

It does create the folder, but nothing gets written into it. :thinking:

  • After more Google, I tried to give access to the mount with these commands:
sudo chown -R www-data:www-data /mnt/recent/dietpi
sudo chmod -R 775 /mnt/recent/dietpi

However, that did not change anything and I’m out of my depth there.

I would really appreciate some help on this!

Thank you in advance!

Can you share some more information on this directory? Is this an external disk you have mounted? If yes which file system format you are using?

Can you share following

ls -la /mnt/recent/dietpi/

Thank you for your reply! DietPi is running inside Windows and the share is an internal NTFS drive. I’m not sure what else to say, other than that I would also like to use that drive/directory for more than just Nextcloud.

Can you share following

ls -la /mnt/recent/dietpi/


Here it is:

dietpi@DietPi:/mnt/recent/dietpi$ ls -la
total 4
drwxrwx--- 2 dietpi dietpi            0 May 12 12:38 .
drwxrwx--- 2 dietpi dietpi         4096 May 12 12:02 ..
drwxrwx--- 2 dietpi dietpi            0 May 12 12:38 nextcloud_data

NTFS might be the issue as it doesn’t support unix file system permission. As you can see all folder belong to user dietpi. Better to use a disk formatted with ext4

Unfortunately that is not really an option, as other parts of the drive are in use by the Windows host. :thinking:

I guess I could add a VHD-based drive that I can mount if things go sideways, but I really would have preferred something that the host can access as well.

Edit: Adding another drive (VHD, in my case) did the trick, though it’s not really a satisfactory solution since a corruption of the whole container is much more likely than one of single files.

probably I need to revert my statement from above. I did some test on my RPi4 64bit using a USB stick. Formatted the USB stick using dietpi-drive_manager as NTFS device and I had no issues to install NextCloud

data location set in /boot/dietpi.txt


sdb1 is the NTFS drive mounted to /mnt/ntfs

root@DietPi4:/mnt/ntfs# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
sda                  14.3G  0 disk
├─sda1 vfat   boot    256M  0 part /boot      8f4dbd00-01                          4ADC-240F
└─sda2 ext4   rootfs 14.1G  0 part /          8f4dbd00-02                          89cef7ba-d45a-47e7-8d42-aff18afcec80
sdb                   3.8G  0 disk
└─sdb1 ntfs           3.8G  0 part /mnt/ntfs  60123f76-01                          7CA1A8E7620FB273

Nextcloud data are located on /mnt/ntfs

root@DietPi4:/mnt/ntfs# ls -la
total 10
drwxrwx--- 1 www-data www-data 4096 May 12 22:30 .
drwxr-xr-x 8 root     root     4096 May 12 22:14 ..
-rw-r--r-- 1 www-data www-data  542 May 12 22:28 .htaccess
-rw-r--r-- 1 www-data www-data    0 May 12 22:28 .ocdata
drwxr-xr-x 1 www-data www-data  240 May 12 22:32 admin
drwxr-xr-x 1 www-data www-data  520 May 12 22:32 appdata_oco7ao8pebus
-rw-r--r-- 1 www-data www-data    0 May 12 22:28 index.html
-rw-r--r-- 1 www-data www-data    0 May 12 22:28 nextcloud.log

Thank you so much for your time! I will try it out to see if that works for me.

I still wonder why using an existing NTFS partition doesn’t work. Oh well. :smiley:

maybe it’s the way how it is mounted? can you share cat /etc/fstab

Here it is:

dietpi@DietPi:~$ cat /etc/fstab
# You can use "dietpi-drive_manager" to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
// /mnt/recent cifs cred=/var/lib/dietpi/dietpi-drive_manager/mnt-recent.cred,iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=3.1.1,nofail,noauto,x-systemd.automount

tmpfs /tmp tmpfs size=1024M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts

/var/swap none swap sw 0 0

UUID=e04e1f9c-91a4-431d-a963-bda660e6d1b6 / ext4 noatime,lazytime,rw 0 1
UUID=55e956cd-0118-47ce-9454-91c053ab781a /mnt/vhd ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount

Ah I see, /mnt/recent is a CIFS/Samba mount and not a real NTFS drive. This is changing the picture completely. And for sure you will be not able to install Nextcloud on a CIFS mount as all permission will be changed to user duetpi. CIFS did not support unix permission at all. Itwould need to be a real NTFS drive or a vhd as you did now.

Okay…as I said in the first post, I mounted the drive via the “Drive Manager” - are you saying I should not have done that and installed another version of Samba instead? At this point, I am happy to uninstall Nextcloud and make all the changes that would be recommended…

P.S.: I would also like to access the www-folder from Windows, which at the moment I can only read but not write, would that help with that as well?

Well you mounted the drive as Samba mount. That’s the issue. This has nothing to do with drive manager. It’s the technology you are using. Samba will not work at all. At least in the direction of exporting the share on Windows and have it mounted on Linux.

Basically you would need to attach the NTFS disk as full drive to your VM. But not 100% sure if this works at the end

Better solution might be using the setup as you have right now and access the disk you have added as ext4, to host you Nextcloud data, via SCP, FTP or Samba. Using Samba would allow you to mount the disk as network share on Windows. This is basically the other way around as Linux is exporting the share and you can have it mount on Windows.

I hope it’s not to confusing now :sunglasses:

I think I get it. What you are saying that by sharing the VHD from DietPi I can still access the files if I need them.

Thank you again so much for your time and effort!!!

I will now open the (related) topic on how to access the www folder directly. :stuck_out_tongue: