Your data directory is not writable nextcloud 23.0.5snap1

I have installed the latest version of nextcloud on my raspberrypi 4 with ubuntu core 20.
I made use of the following commands to install nextcloud.

sudo snap refresh
sudo snap install core core18
sudo snap install nextcloud
sudo mkdir /var/snap/nextcloud/common/nextcloud/data/
sudo mount /dev/sda1 /var/snap/nextcloud/common/nextcloud/data/
sudo nextcloud.manual-install username password
sudo nextcloud.occ config:system:set trusted_domains 1 --value=ip-adres
sudo ufw allow 80,443/tcp
sudo nextcloud.enable-https self-signed
sudo snap connect nextcloud:removable-media
sudo nextcloud.occ maintenance:mimetype:update-db
sudo nextcloud.occ maintenance:mimetype:update-js
sudo nextcloud.occ maintenance:theme:update
sudo snap restart nextcloud

but after a while i get the following error:

Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/23/go.php?to=admin-dir_permissions.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /snap/nextcloud/30877/htdocs/lib/private/Console/Application.php:164
Stack trace:
#0 /snap/nextcloud/30877/htdocs/console.php(98): OC\Console\Application->loadCommands()
#1 /snap/nextcloud/30877/htdocs/occ(11): require_once('...')
#2 {main}root@ubuntu:/var/snap/nextcloud/current/nextcloud/config#

does someone know what to do. I have done the install multiple times manual as well.

If the drive is in EXT4 or BTRFS format, follow the steps outlined in the link below

If your drive is formatted as NTFS

  1. Run the blkid command and find the UUID for your drive and write it down.

  2. Create the mount point where you want it to mount. In my case I only managed to get it to work in the /mnt/ folder

Example:
cd /mnt/
mkdir /Nextcloud/

  1. Edit your /etc/fstab file with your preferred editor and add the line below

UUID=0071900363FC570D /mnt/Nextcloud ntfs-3g utf8,uid=root,gid=root,umask=0007,noatime,x-gvfs-show 0 0

Obs

Change the UUID to the value corresponding to your unit

Remember the drive cannot be recognized by Nextcloud if it is mounted at /media/user/path.

Restart the system to apply the settings.