I have multiple drives in the server but it only stores in the / one. How can i use the remaining two drives to save it?

It looks like there is a more simple solution for you with mhddfs or mergerfs. Both should give you advantages without destroying current setup.

very hard to say. There is no “that handbook” for all about running linux.
The best thing you could do is probably saveing your important stuff to an stick or additional drive and just try advice you get. If you may mess with the server don’t very try it again.

And with each try you gonna get better and better.

Hey, Now I need to do this. Let’s see what I got :slight_smile:

Checking this out!!

Hey, @gas85 I just heard that we can use the External Storage Addon on nextcloud to use the additional HDD on the server? I just installed and set it up and it is showing the content of my /home, so I guess it’s properly set up.

But, I want to ask you that setting it up won’t have any problem in future, right? Also, there isn’t any speed issue with it?

1 Like

No it is standard way to add some other storage’s. Only it will not add to your root home folder, but as additional folder.
if you add it as Local storage, there will be no speed degradation at all.

Just be aware that if you modify/add/delte files not via NC but locally, you need to perform rescan of this external storage. You can use this command:

Or even add it to crontab Automate OCC Filescan - #22 by gas85
If you will have more storage’s, them use this nice script:

Crontab automatically scans it after particular time, so basically once I set the crontab, I don’t have to worry about anything, right?x

1 Like

While using your command, I got this error - Console has to be executed with the user that owns the file config/config.php

But when I checked, my config.php is under nextcloud/config/config.php

and my user is under nextcloud/data/user…

You have to use e.g. sudo -u www-data ... to run command under user www-data. And configure it to corresponding crontab.

  1. Check to whom belongs your occ. Run to see:

    sudo stat -c %U /var/www/nextcloud/occ
    

    Where /var/www/nextcloud/occ is path to your OCC command in nextcloud.

    For me user is www-data:

    sudo stat -c %U /var/www/nextcloud/occ
    www-data
    
  2. Execute command under user from above:

    sudo -u www-data php /var/www/nextcloud/occ files:scan --path="/USERNAME/files/FTP_Mount_Point"
    

    Or for script

    sudo -u www-data nextcloud-file-sync.sh
    
  3. Configure crontab of www-data

    sudo crontab -u www-data -e
    

    In Crontab you do not need to use sudo -u www-data at the begging, because it is crontab of this user already.

Same!

Both commands have error -

How to do that?

So, what exactly I have to put?

Shouldn’t this command be -

As the new external storage is at /home ?

According to the documentation you should put internal mounting point name: Using the occ command — Nextcloud latest Administration Manual latest documentation

"user_id/files/mount_name"

And yes, to run command outside of the NC folder you have to replace occ with absolute path.
Use this command to find out your mount_name:

sudo -u www-data php /var/www/nextcloud/occ files_external:list
+----------+--------------------------------+---------+-----------------------+-------------------------------+----------------------+------------------+-------------------+
| Mount ID | Mount Point                    | Storage | Authentication Type   | Configuration                 | Options              | Applicable Users | Applicable Groups |
+----------+--------------------------------+---------+-----------------------+-------------------------------+----------------------+------------------+-------------------+
| 19       | /Externals/Local-Videos        | Local   | None                  | datadir: "\/var\/Downloads\/" | enable_sharing: true | gas              |                   |
+----------+--------------------------------+---------+-----------------------+-------------------------------+----------------------+------------------+-------------------+

E.g. for me one of externals will be under /Externals/Local-Videos.

Put in crontab e.g. to execute each 20 min (read more about):

*/20 * * * * /usr/local/bin/nextcloud-file-sync.sh #Nextcloud external Files rescan
#OR
*/20 * * * * /usr/bin/php /var/www/nextcloud/occ files:scan --path="user_id/files/mount_name" 

P.S. This rescan is only needed for the case when you update your files outside of the nextcloud = locally.

Hey, I just tried and it worked.

sudo -u www-data php /var/www/nextcloud/occ files:scan --path="/mukeshwargreat@gmail.com/files/"

But I think it’s for scanning the internal files, which I think is not needed since Nextcloud can easily find them all. However for external files, I think we need to scan them after like 20 minutes(as you said). This comes for external path.

Like, this -

Try /Home and regarding the docu it shoud be like /mukeshwargreat@gmail.com/files/Home.

Guess what, it worked!

So, now the only thing remaining is editing my cron file with this code, right?

*/20 * * * * /usr/local/bin/nextcloud-file-sync.sh

Also, instead of the code above, can I use the below one too?

*/20 * * * * /usr/bin/php /var/www/nextcloud/occ files:scan --path="/mukeshwargreat@gmail.com/files/Home"

1 Like

Hey, @gas85 we are at the last step bro. You have helped a lot, just a last answer, and this thread will be solved and be a great help for other customers.

Yes, you can use this:)

1 Like

Hey @gas85

I have two new problems.

First, I am using Pyooclient to put files in Nextcloud from the backend, and it was working perfectly earlier but now it throws a 400 error.

Second, I am trying to Create a folder in my External Folder, but I can’t… It says Forbidden

What’s the solution!

Also, I have a folder with the External Storage, it doesn’t mix with other storage. Is it supposed to be this way?

only scrolled shortly a bit over the thread in my coffeebreak.
First hand i’d say yes it should be this way what you did.
If you like to enhance your storage accross multipal drives maybe you’d like to think about RAID Arrays.
In Your Case i’d say RAID 5 should do the job. Afterwords the Array can be addressed as single logical memmory unit to store the data Folder of your Nextcloud instance.