I was looking for a tutorial on this matter but couldn’t manage to succefully do this:
My ubuntu is installed initially on a single 500GB HDD and after configuring everything I am able to see only about 450GB free space in my Nexctloud (which is normal). Now I installed 2 additiong internal HDDs (4TB each). Mounted them in nextcloud data folder and I see them listed in my NC system settings but the available space is still only ~450GB. How do I add the space of these 2x4TB drives to my nextcloud?
I would also like to add aditional external HDD available only for a specific user. So how to do this as well?
And finally - is it possible to mirror/backup my files so if any of my hdd fails I would have a backup?
When I ran the sudo -u www-data php occ files:scan --help I got an error: Could not open input file: occ. So I thoough i have a privileges problem and searched online how to give access to all users in my system (only me and some system users\groups).
I ran several 744 and 774 chmod commands to nextcloud paths and now when I try to open my nextcloud I get the message : Forbidden: You don't have permission to access this resource..
Tried sudo chown -R www-data:www-data nextcloud/ but couldn’t fix it. So now I am trying to geet my access back and fix the Could not open input file: occ
I will definetelly look up lvm once I fix my system.
You were right that I was not tunning the sudo -u www-data php occ files:scan --help in the correct directory. Running it in the nextcloud directory gives the following errors which I’ve just found and did not research on my own yet:
PHP Warning: require_once(/var/www/nextcloud/console.php): Failed to open stream: Permission denied in /var/www/nextcloud/occ on line 11
PHP Fatal error: Uncaught Error: Failed opening required '/var/www/nextcloud/console.php' (include_path='.:/usr/share/php') in /var/www/nextcloud/occ:11
thrown in /var/www/nextcloud/occ on line 11
occ file at line 11:
require_once __DIR__ . '/console.php';
Meanwhile, the restoring of the permissions seems not working for me. I’ve ran the 2 commands you are offering in the correct directory. But I still don’t have access when I try to enter my NC (locally and remotely). I’ve looked up the commands I ran when things messed up and I see I’ve ran also sudo chmod 774 /var/www. Might that be another reason for the NC to deny access and if yes - what number chmod should I assign to it?
Although the super helpful answer from Vincent, I did my own research and decided to use RAID instead of LVM, because of more reliability in case of failure - as far as I read the LVM has also data mirroring but I found more info about this matter online for raid system and I decided to choose that.
I followed these steps as well as Vincent’s advice to set the RAID 1.:
I set the ownership of the mounting folder to www-data and edited the nextcloud’s config.php file and was ready to check for any progress, but when I started NC there was a error of a missing “.ocdata” file which I simply copied from the old data folder to the new and everything is up and runing now.
Thank you all and especially Vincent for the very helpful advices!
It seems that the problems with the permissions persist.
At first, when I resolved the missing .ocdata file by copying it, I was able to enter NC dashboard, but I wasn’t able to manage files. A simple upload would give “Forbidden” message, not able to open/delete existing files as well. Tried to set the accurate permissions following thtis advice:
directories should be 750
files should be 640
But I got the missing .ocdata error again and I can not fix it for now. Switching the data directory back to the old one fixes the problem but I’m using only the main hdd, where Ubuntu was installed.
Any ideas would be welcome.
Here are the permissions of my data folder as of now :
you made a wise choice to read up and setup on your own way.
simply look at your directories as user www-data
it needs atleast read access in /mnt/md0/nextcloud
and atleast write access in data
check owner of /mnt
if its root:root user:group so user www-data is other it needs read access here and execute as its a directory
if it 750 drwxr-x— change to 755 drwxr-xr-x
chmod 755 /mnt
do this for /mnt/md0 if not owned by www-data
from /mnt/md0/nextcloud the owner:group can be www-data:www-data and chmod 750 should be applied
If for security reasons 755 is not permitted by yourself the alternative approach would be to change the group of /mnt/md0 either to www-data or to a newly created group and add www-data to that newly created group.