Can i setup the data/database on a separate physical internal drive?

hi, i am barely learning nextcloud and linux, and i want to safeguard my data. i am setting up my own cloud for the family to store all our data and also run some basic game servers. it will be used on lan as well as remotely.
hardware: Intel NUC 11 NUC11PAHI5
mem:64G
storage: drive1= ssd sata 1TB and drive2= m.2 ssd 4TB
OS: Ubuntu 22.04 server
nextcloud: latest version (haven’t reinstalled it yet).

i did setup nextcloud a few weeks back with external help on a single 4TB drive, and was running fine. but being a noob i ran a horrible command that rendered the server useless. i am reinstalling everything now after losing all my work and data. so i got the secondary drive and using it for the server os and programs.
being a previous windows user, i always had my data on a separate partition or drive in case i had to reinstall the os.
can i have nextcloud on one drive and the database/mydata on another, so that if i ever need to reinstall the server, i can have my data safe on a separate drive?
i will also have monthly backups on a external drive, once i get to that and figure things out as i go.

thnx for any help i can get.
jack

Sure. Although it can be done later, the easiest way with Ubuntu is to do it during OS installation. For example if you were to mount /var to the second drive, then anything that goes under /var would be there. Typically that would include both MySQL and your web root, but it really depends on how your system and Nextcloud are set up.

My thoughts were pretty similar to yours and i set up a OpenMediaVault (OMV) to store the data and use the External Storage feature in NextCloud. This way I can share out and rsync the data to other servers in OMV and share the data to humans for their use and manipulation through OnlyOffice in NextCloud. I’m sure it’s not the “cleanest” but I’m too ignorant in databases to comprehend a better solution.

thanks KarlF12,
im glad to here it is possible and i am early enough in the setup to start over and do it during the server installation. so if i understood it correctly it’s not quit like my windows background knowledge where i can install server and all apps, including nextcloud and its depended apps, on one drive and then have the second drive to host the database? i actually have to install some of the apps on the secondary drive partition and sorta what i would call network mapping a drive to /var folder. am i correct in the thought of how it works? also any recommendations for articles or tutorials for setting up the partitions correctly the way i need them?
thnx.
jack

hi sidewyz1,
im not familiar with OMV, i will look into it. my thought was as a previous windows user to just have a separate drive and/or partition to store my data so in case i need to reinstall the server os many times as needed without touching the data drive/partition. and then just point my apps to the data drive. i will look at OMV to see if it fits my needs.
thnx
jack

I have also attached a USB drive to a pc with only one hard drive bay and ran my data on the USB drive connected again through External Storage. I was able to use rsync to a different box for data backups. Thinking about it, this may satisfy your needs fine and is a bit less complex.

Edit:

General path:
Install Ubuntu server on the 1tb drive and get that running. Mount the 4tb drive in /media and create your data directories. Use rsync or winscp to copy your data to the 4tb. Create entries in /etc/fstab for auto mount. Point NextCloud’s External Storage to the mounted directories.

Just to give some clarification, with Windows the most common practice is to have multiple file system roots, represented by drive letters.

With Linux there is only one file system root, and other file systems are mounted to empty folders under it. Windows can do this too but it’s not a common practice.

As far as options, there are some different ways to approach it. You can mount part of the system like /var as I mentioned. You could also mount it to a completely new place like a folder under /mnt and then use symlinks to selectively move folders under it to go on the other drive.

This is well beyond the scope of Nextcloud so you’ll need to do some research and some learning on how all this works so you can maintain your custom setup long term.

There are actually “right places” and “wrong places” so to speak to mount and store data. Reading about that will give you valuable insight, so you might start there.

1 Like