Storing Data in 2nd Hard Drive & Not Boot Drive

Greetings,
I have a brand new Ubuntu Server with a 250GB boot SSD drive and a 2TB secondary SSD drive which I have earmarked to save my data to. I recently performed my first test install of the latest Nextcloud v25 onto my Ubuntu Server v22.04. I followed the YouTube video in the link below:

https://www.youtube.com/watch?v=5IUKE3oA7AY

The video was helpful in guiding me through a traditional installation process of Nextcloud done from scratch and not using the Snap approach. Unfortunately, Jay the teacher in the YouTube video did not show the steps involved to get Nextcloud to save all the data onto the 2TB secondary SSD hard drive and not on the 250GB SSD boot drive.

I am going to erase my boot drive and I am going to install Nextcloud for a second time. However, this time I want to configure Nextcloud while I am installing it so it saves onto the 2TB secondary hard drive my photos, music, contacts, etc.

Can anyone in this community please point out to me where exactly in the Nextcloud installation process do I specify the path to the 2TB secondary drive to Nextcloud so it saves to this drive and not the 250GB boot drive?

At the very end of the Nextcloud installation process it shows the “DATA FOLDER” parameter shown in the graphic below. Is this the correct point in time where I need to specify the path to my 2TB secondary hard drive? Or will it be easier to just change the path Nextcloud saves the data to after the installation is completed?

Confusing me even more is the part where I install the MariaDB. Am I correct to assume the path to my 2TB SSD drive is specified when I install the MariaDB? At the top Jay instructs to type in the command “CREATE DATABASE nextcloud;”. Should this command be expanded to include the path to my 2TB SSD drive?

Any tips will be greatly appreciated.

That’s entirely unnecessary.

It is indeed; however, you must prepare the folder yourself in advance. Make the folder on your other drive, and chown www-data:www-data and chmod 750.

You can probably just move the existing data folder. Stop Apache and MariaDB before you try it. Make sure permissions and timestamps do not change. Then update the Nextcloud config file with the new path before starting it back up.

MariaDB is a completely separate program from Nextcloud. Nextcloud uses it for its database. I would leave that on the SSD since it’s not likely to become large, and it would benefit from the speed.

KarlF12, thanks for the tips.

Does anybody in the community know of a link that shows the steps / terminal commands to move a Nextcloud data folder directory from the boot drive where it resides right now over to a 2TB internal SSD drive? I would like to see something in writing before I move forward with this task. Any info welcome. Thank you for your time.

mv /path/to/nextcloud/data /path/to/externaldrive/

Then in nextcloud/config/config.php

Change the path to the data.

@slipstream
Maybe you can use better rsync to only copy.

mkdir /path/to/externaldrive/path
chown www-data:www-data /path/to/externaldrive/path
rsync -av /path/to/nextcloud/data/ /path/to/externaldrive/path/

If you use / at the end of the paths of rsync only the content and not the directory is synced.
That is a less risk for you.

And make a backup before use mv or rsync.

2 Likes