Nextcloud does not allow moving the data folder?

Kerasit,
Thank you for your post. Below is the result I got after i executed your posted command line.

me@mysrvr:/$ sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --on
Console has to be executed with the user that owns the file config/config.php
Current user id: 33
Owner id of config.php: 0
Try adding 'sudo -u #0' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 0' to the docker command (without the single quotes)

I then added the ‘sudo -u #0’ as shown below:

sudo -u #0 www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --on

Below is the result I got:
sudo: option requires an argument -- 'u'

I then Googled the problem and tried the modified command below based on the post below:
sudo -u 'www-data' php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --on

My skills are not advanced enough to see what the problem is but here is what does not make sense to me. The command above is defining sudo -u 'www-data' as a user. Isn’t the ‘www-data’ user the correct user to integrate into the command line? Why is it rejecting the use of the ‘www-data’ user?

Below are the steps as I understand them so far:
Step#1: Run command line below.
sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --on

Step#2: Add apc.enable_cli = 1 to php ini file located at /etc/php/8.1/cli/. And you also say to addapc.enable_cli=1 at the bottom of the correct .ini file. Can you tell me which one is the correct .ini file?

Step#3: Copy the existing data to it’s new location
sudo -u www-data cp -r /var/www/nextcloud/data/. /mnt/8TBdata/

Step#4: Set your new data location
sudo -u www-data php /var/www/nextcloud/occ config:system:set datadirectory --value=/mnt/8TBdata

Step#5: Disable maintenance
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

Any advice anybody in this forum can offer about this new problem relating to my manually installed Nextcloud will be greatly appreciated. Thank you for your time.