HOW do i change the data directory (Pi5 8Gb + Ubuntu24.0 srvr + Casaos + Next Cloud + External storage (usb))

Hey all,

So i have spentt 3 days on and off trying to get a 5Tb drive plugged into the USB to be uased as THE storage for user files etc.

So i ALL works, BUT… BUT…

Lett me say yeah, i am a 54yo NOOB (get it over with LOL) and want to move from OMV to NextCloud.

So when installing in Casaos i edited settings to add the path. I also tried using the autoconfig file. I also added the external drive app.
i ALSO watched countless videos on YT that KINDA gave an idea but failed OR wasn’t logical based on my setup.

I even installed and let the admin account sit on the nVME drive (256Gb) and then tried to change where user data is located using external drive setup etc etc

I like what Nextcloud offers BUT maybe i am out of my depth AND league on this.

as i say, on the net and YT there are MANY MANY tutorials BUT none that have my setup. those that do use cloud providers or some other setup that the command line or terminal stuff doesn’t help all the way.

simply, i want users to be on an attached HDD and not internal drive. Any help is great - or link to another tutorial(s) LOL

Thanks

I’m not familiar with casaOS but I checked there demo and it looks nice.
on the left of casaOS dashboard next to account there is settings.
in here is

Automount USB drive

is this enabled?

Is your 5Tb drive available in the casaOS storage manager ? eighter under storage or drive ?

Here is what I think.

open NC settings on the casaOS dashboard ( 3 dots > settings)

Next to volumes click +add

under host I used as example

/DATA/AppData/nextcloud/data

this should be pointing to your 5Tb disk

under container I filled in

/srv/data

I then went to > /DATA/AppData/nextcloud/var/www/html/config/config.php and added this line

‘check_data_directory_permissions’ => false,

because I don’t know how to change permissions in casaOS and it kept complaining that the data dir is visible to the world and this should be set to 0770 for them (0750 is even better )

Then launch nextcloud setup and point your data directory to /srv/data

This resulted in the data being stored in /DATA/AppData/nextcloud/data hence the host should point to your 5Tb disk.

It would be great if you have console access. I need some more info about the 5Tb disk.

Thanks for your response. Yeah, in Casaos the drive is available, in fact i have anotber instance on my network as a media server with Jellyfin etc. Working perfectly.

So in this instance, the drive is working and mounted and accessible, even as a share i can access via any device on the network.

Its once in NC i can see it, i can mount or configure a volume etc and access is working. I added in the config. BUT i see you recommended another change in the config which i will try.

Thank you, I’ll confirm later how it went :blush:

Yes I’ve added this line in the config to avoid a security check. If it helps you and make things work you should still set the correct permissions and remove the line or set it to true later.
Keep us updated

thank you Vincent. i will mess around today. i just may run a VM and see if it works - may add another layer of complexity LOL but let’s see.

Appreciate your assistance. Will update you.

got it working under a vm :slight_smile:

you need to set the disk permission to user www-data.

here is a example if your 5Tb disk is /dev/sdb and has no data
first create a partition in your disk using all the space (5tb)

sudo fdisk /dev/sdb
n
[ENTER]
[ENTER]
[ENTER]
[ENTER]
w

next create a filesystem on it

sudo mkfs.ext4 /dev/sdb1

next we make sure this disk is mounted at boot running this command

echo “/dev/sdb1 /mnt/nc_data ext4 defaults 0 0” | sudo tee -a /etc/fstab

now we need to make the directories so we can mount it with

sudo mkdir /mnt/nc_data
sudo mount -a

now we need to create a directory for nextcloud to write to

sudo mkdir /mnt/nc_data/users
sudo chown www-data: /mnt/nc_data/users
sudo chmod 750 /mnt/nc_data/users

this should complete the disk preparation.

now we can add this drive in the nextcloud settings as posted above

under host point it to /mnt/nc_data/users
under container point to /srv/data this is the data path for the nextcloud setup it may point to anywhere

now you can setup nextcloud and use /srv/data as user-data-path.

now everything should work and the line in the config should be set to true or remove it.

this completes this tutorial

Best of luck.

DAMN mate! haha - ok - well i am still at work and reinstalled the Pi about 4 times - even tried NC on OMV7 - that was a pain just to get docker on. I decided to backtrack and go CasaOS again.

I will try your steps about. thanks SO much for your efforts it IS appreciated.

I will definitely update you :slight_smile:

Sorry i do not know CasaOS. But normally your second HDD/SDD is formated and you can mount it. Of course, the user for Webserver/Nextcloud/CaseOS must also be the owner of the folder.

Then you can normally use in Nextcloud in config.php:
'datadirectory' => '/mnt/demo123',

Basically, you should build up more Linux know-how, even if CasaOS might support you. Even if you can get it up and running. What are you going to do if it breaks down at some point? Is it ok if you then lose all your data or shares?

Here to compare one installation guide for Nextcloud Debian 12 and Nextcloud Ubuntu 22.04 LTS (differs only a little to Ubuntu 24.04 LTS). But it does not use e.g. Docker.

Hey Vincent,

thanks a million. It worked. Well the issues was the shares and how i mounted them BUT more so, the variables in NC for the location of the data.

I now have NC putting user data into the attached storage and never needed to add the external drive app!

i really appreciate the effort you put in to help me!

1 Like

I’m happy if you are.

your welcome

2 Likes

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.