NextCloud alternate data location



  • Cannot seem to get an alternate data location to work in Nextcloud. I built a new Fedora (minimal) server VM in my lab. Attached a new vdisk to the vm for data. My main vm is 20 gb and the data is 127 gb. I realize this is irrelevant. I mounted the vdisk to the server as /ncdata

    Again, using @JaredBusch guide (which has never failed to work using the default locations) to set up the new test system. I adjusted the selinux script to reflect the correct data location. I also edited the php.ini file to reflect it as well. Everything works except not being able to write to that /ncdata folder. I have changed the owner of that folder to apache and it is confirmed by issuing ls -la while in that folder. I can find tons of info on moving the data after install but it seems most users go with the defaults. What am I missing? I have been working on this for a while and started over a few times. Still no change in the end result. I am trying to follow "best practices" but struggling.



  • @brandon220 said in NC alternate data location:

    Cannot seem to get an alternate data location to work in Nextcloud. I built a new Fedora (minimal) server VM in my lab. Attached a new vdisk to the vm for data. My main vm is 20 gb and the data is 127 gb. I realize this is irrelevant. I mounted the vdisk to the server as /ncdata

    Again, using @JaredBusch guide (which has never failed to work using the default locations) to set up the new test system. I adjusted the selinux script to reflect the correct data location. I also edited the php.ini file to reflect it as well. Everything works except not being able to write to that /ncdata folder. I have changed the owner of that folder to apache and it is confirmed by issuing ls -la while in that folder. I can find tons of info on moving the data after install but it seems most users go with the defaults. What am I missing? I have been working on this for a while and started over a few times. Still no change in the end result. I am trying to follow "best practices" but struggling.

    Did you turn off SELinux? Not just adjust the settings? sudo setenforce 0

    Does apache own the folder?

    0_1538667094935_54e50575-879c-49fb-a774-371800c18142-image.png

    edit: screenshot form a system that was originally ownCloud 7. It has been upgraded over the years and is now Nextcloud 13 (14 not showing in updater yet).



  • @jaredbusch said in NC alternate data location:

    Did you turn off SELinux? Not just adjust the settings? sudo setenforce 0

    Obviously, this is to prove it an issue or not.



  • On one of the other test installs from a few days ago, I disabled selinux as a test and it made no difference. I fully believe this is a permissions problem but I am unsure of how to resolve it. It shows apache apache as the owner. It could be that the "root" of /ncdata is still owned by root, but it looks like your example. I did not disable selinux on this one as I am trying to do it correctly from the beginning. Maybe there is a "better" order of what I'm trying to do.



  • What does your config file have in it?
    sudo cat /var/www/html/nextcloud/config/config.php

    [[email protected] ~]$ sudo cat /var/www/html/nextcloud/config/config.php
    <?php
    $CONFIG = array (
      'instanceid' => 'XXXXXXXXXXXXXXX',
      'passwordsalt' => 'XXXXXXXXXXXXXXX',
      'secret' => 'XXXXXXXXXXXXXXX',
      'trusted_domains' => 
      array (
        0 => 'nc.daerma.com',
      ),
      'datadirectory' => '/var/www/html/nextcloud/data',
      'overwrite.cli.url' => 'https://nc.daerma.com',
      'dbtype' => 'mysql',
      'version' => '14.0.1.1',
      'dbname' => 'nextcloud',
      'dbhost' => 'localhost',
      'dbport' => '',
      'dbtableprefix' => 'oc_',
      'dbuser' => 'XXXXXXXXXXXXXXX',
      'dbpassword' => 'XXXXXXXXXXXXXXX',
      'logtimezone' => 'UTC',
      'installed' => true,
      'memcache.locking' => '\\OC\\Memcache\\Redis',
      'memcache.local' => '\\OC\\Memcache\\Redis',
      'redis' => 
      array (
        'host' => 'localhost',
        'port' => 6379,
      ),
      'htaccess.RewriteBase' => '/',
      'overwriteprotocol' => 'https',
      'mail_smtpmode' => 'smtp',
      'mail_from_address' => 'XXXXXXXXXXXXXXX',
      'mail_domain' => 'XXXXXXXXXXXXXXX',
      'mail_smtphost' => 'XXXXXXXXXXXXXXX',
      'mail_smtpport' => '25',
      'maintenance' => false,
      'loglevel' => 2,
      'theme' => '',
    );
    


  • <?php
    $CONFIG = array (
    'instanceid' => 'xxxxxxxxxxxxx',
    );

    Not sure where the config file went. I am puzzled even more now. I had the same issue on the other server but the config.php file was there. May need to start over again.



  • @brandon220 said in NC alternate data location:

    <?php
    $CONFIG = array (
    'instanceid' => 'xxxxxxxxxxxxx',
    );

    Not sure where the config file went. I am puzzled even more now. I had the same issue on the other server but the config.php file was there. May need to start over again.

    You should have config.sample.php file in /var/www/html/nextcloud/config where you would copy and name config.php



  • @black3dynamite The sample config file is there. I have zero clue as to why the normal config.php is missing. I did not delete it.



  • @brandon220 said in NC alternate data location:

    @black3dynamite The sample config file is there. I have zero clue as to why the normal config.php is missing. I did not delete it.

    Did the install wizard finish? It will not be complete if not.

    Are you trying to use the changed data location during install? That would explain this.



  • @jaredbusch Yes. I thought that was how it is supposed to work. I assumed that you made sure the permissions were correct and it would update the necessary files to reflect the proper data location.



  • I thought that was the correct process to avoid having to "move" the data location later. I set up the folder for the data before the install. I point NC wizard to the location I would like to use for data. That is when the error comes in to play. Everything I read says to do this versus moving the data location after the install. On the install guide by @JaredBusch it says "Personally, if you are going to use a separate disk for the data, I would just mount it to /var/www/html/nextcloud/data" but I am not sure what that is referring to.



  • @brandon220 said in NC alternate data location:

    I thought that was the correct process to avoid having to "move" the data location later. I set up the folder for the data before the install. I point NC wizard to the location I would like to use for data. That is when the error comes in to play. Everything I read says to do this versus moving the data location after the install. On the install guide by @JaredBusch it says "Personally, if you are going to use a separate disk for the data, I would just mount it to /var/www/html/nextcloud/data" but I am not sure what that is referring to.

    If you have a second disk available like /dev/sdc1, you would mount it to /var/www/html/nextcloud/data

    And in /etc/fstab file, it would look like something this:
    /dev/sdc1 /var/www/html/nextcloud/data xfs defaults 0 0



  • @black3dynamite I will try this. I am assuming you just install using the defaults and only map it in the fstab? This is similar to what I do for my Plex server. I have the "library" mapped to the server via the fstab file and the data is on a NAS.

    Is there any way to make it work the way I have described?



  • @black3dynamite I currently have /dev/sdb1 mounted as /ncdata. I did not edit the fstab file yet.

    /dev/sdb1 133102084 165696 132936388 1% /ncdata

    Should I change this first or leave as it is? Seeing that it already has a mount point, I didn't know if it will cause errors.



  • @brandon220 said in NC alternate data location:

    @black3dynamite I currently have /dev/sdb1 mounted as /ncdata. I did not edit the fstab file yet.

    /dev/sdb1 133102084 165696 132936388 1% /ncdata

    Should I change this first or leave as it is? Seeing that it already has a mount point, I didn't know if it will cause errors.

    Your mount is fine.



  • @black3dynamite I have it working now. Thank you very much for the advice. What I cannot seem to understand is why it won't work by pointing to the /data location in the wizard. It seems from all the reading I have done that it should be possible. Yet, I always fail to make it work that way. Also, in @JaredBusch guide he states "Leave the data folder alone unless you know that you changed it when going through the above instructions." I thought this would be way easier but yet fails.



  • @brandon220 said in NC alternate data location:

    @black3dynamite I have it working now. Thank you very much for the advice. What I cannot seem to understand is why it won't work by pointing to the /data location in the wizard. It seems from all the reading I have done that it should be possible. Yet, I always fail to make it work that way. Also, in @JaredBusch guide he states "Leave the data folder alone unless you know that you changed it when going through the above instructions." I thought this would be way easier but yet fails.

    What you did is how it is supposed to work. I’ve done it. But not recently. I will try and set up a test instance at some point, but SW is next week.... yeah, you are going to have to remind me.



  • @jaredbusch Sure thing. Running Fedora Server 28 minimal from net install image and NC 14.0.1.
    I have tried multiple times and it always fails if I try to move the data location.



  • @JaredBusch I am sure you forgot about this by now... I was looking at @scottalanmiller script at https://gitlab.com/scottalanmiller/nextcloud_fedora_installer and it appears to do what I was doing manually following your guide. He has the script creating /data. I have not run the script on Fedora 28 and changed it to reflect NC 14.0.1 to see if it will work. Ultimately, I want the data on a separate partition. Still cannot get it to work without using fstab to mount my data folder.



  • @brandon220 said in NextCloud alternate data location:

    @JaredBusch I am sure you forgot about this by now... I was looking at @scottalanmiller script at https://gitlab.com/scottalanmiller/nextcloud_fedora_installer and it appears to do what I was doing manually following your guide. He has the script creating /data. I have not run the script on Fedora 28 and changed it to reflect NC 14.0.1 to see if it will work. Ultimately, I want the data on a separate partition. Still cannot get it to work without using fstab to mount my data folder.

    If you want to manually mount a partition using something other than fstab, then you'd also have to manually start the web server Nextcloud is running on. It's just how the boot process works, fstab is the proper place to mount any drive or partitions.



  • @travisdh1 My dilemma is that I am trying to set up NC with an alternate "data" location which is set as /data. I can install NC all day long without issue unless I try to move the data location during install. I have tried both ways - a data folder in the same partition as the OS and with a separate disk (virtual) that is mounted as /data. Neither of those will work. I get permission errors. Apache:Apache is the owner, etc. but it does not work. I can use the default location in /var/www/html....and it works fine. If I use fstab to mount /data to /var/www/nextcloud... it works. I have been pounding my head against the wall. Everything seems correct but it has the permission on the /data in the wizard. I want a small install for the OS and a large data drive (both virtual disks). I need to retire my old server but want to set up the new one following best practices. Not having any luck as you can see.



  • @travisdh1 On on one of the test instances I used Cockpit to mount the new vdisk as /data and that works fine. NC jsut doesn't like the permissions even though apache:apache is the owner.



  • @brandon220 said in NextCloud alternate data location:

    @travisdh1 My dilemma is that I am trying to set up NC with an alternate "data" location which is set as /data. I can install NC all day long without issue unless I try to move the data location during install. I have tried both ways - a data folder in the same partition as the OS and with a separate disk (virtual) that is mounted as /data. Neither of those will work. I get permission errors. Apache:Apache is the owner, etc. but it does not work. I can use the default location in /var/www/html....and it works fine. If I use fstab to mount /data to /var/www/nextcloud... it works. I have been pounding my head against the wall. Everything seems correct but it has the permission on the /data in the wizard. I want a small install for the OS and a large data drive (both virtual disks). I need to retire my old server but want to set up the new one following best practices. Not having any luck as you can see.

    I remember having issues, but they were with selinux, and @JaredBusch's guide steps through all the needed changes for that. I'll have to try a fresh install and see if I have problems with it.



  • @travisdh1 I thought that was the issue as well and temporarily disabled selinux and it did not fix my issue.