Changing the Place of Installation

I have installed NC on a Raspberry Pi 3 as follows:

  • Raspbian 4.19.66-v7+
  • PHP 7.3.9
  • nginx 1.10.3
  • Nextcloud

This Raspberry is connected with an HDD via USB. The mount point of the HDD is /var/www.

I want to change my installation in order to have /var/www/html/data on the HDD but all other files of the installation on the SD card of my Raspberry.

How can I achieve this without reinstalling NC from the scratch?

So where is your nextcloud installed? Normally it is in /var/www/nextcloud or /var/www/html/nextcloud, so with your HDD mounted at /var/www, it would be not accessible anymore on the SD card.

Would it be an option to mount the HDD to /var/lib/nextcloud instead? Then you could just put your data directory there and leave the installation at /var/www/nextcloud. Just change the datadirectory in your config file, and make sure the data directory has the ownership and privileges of the nextcloud installation. You might need to do a
php occ files:rescan --all

Did you think about to make your HDD bootable? Then you can have your complete installation on the HDD and remove the SD card. I have a raspberry running very reliable that way, with a SSD.