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?

sudo cat /etc/fstab - This worked.
Screenshot 2021-03-14 at 1.27.10 AM

I’ll just back up the whole server, just in case something happened. Also, I have a question - I’m running a Python script in /root and I want it to run for a couple of weeks, will these steps can cause it to step?

P.S. - I can’t stop it…

Ok, let’s leave everything. Can you please help me out with this? Like, give me the commands to do the thing! Please!!

This I can’t predict, if script using your home directory for config, input or output savings then it probable will be interrupted.

Basically this is a global plan to do 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? - #10 by gas85
and this is detailed description of step 4 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? - #18 by gas85

If you succeed with this, then for the rest it is simple:
For step 5 e.g. this tutorial. Do not miss up - you need to delete md3. First unmout it.
For step 6 you need to remove /dev/sda4 and /dev/sdb4 - on both HDDs. Do not miss up. First unmout it.
For step 7 you need to grow your partition with e.g. sudo resize2fs /dev/sda3 and sudo resize2fs /dev/sdb3.
For step 8 I didn’t found straight way for a root partition, e.g. this could help. And this is a good tutorial to grow partitions. As it root this could cause problems with expanding mounted partition.

Alright. I’ll wait for my program to end and then will start these actions.

Oh, I forgot to thank you for taking the time to help :)))) Thanks bro, always help Noobs like me :slight_smile:

1 Like

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