Possible to get nextcloud to run from USB-harddrive? Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
juliuscaesar

Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

Thanks for the awesome DietPi project, it is simply just fantastic!

I wonder though if it's possible to get Nextcloud to store the database onto my USB-harddrive that i have set as the primary storage unit, directly after the initial setup. I thought that dietpi would change the database the the USB-harddrive automatically during the nextcloud installation?

Or does this only work for OwnCloud?

Thanks in advance!
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Possible to get nextcloud to run from USB-harddrive?

Post by Fourdee »

juliuscaesar wrote:Thanks for the awesome DietPi project, it is simply just fantastic!

I wonder though if it's possible to get Nextcloud to store the database onto my USB-harddrive that i have set as the primary storage unit, directly after the initial setup. I thought that dietpi would change the database the the USB-harddrive automatically during the nextcloud installation?

Or does this only work for OwnCloud?

Thanks in advance!
Hi,

The MySQL DB is stored on rootfs (eg: flash/sd). The user data (eg: stuff you save to NextCloud) is stored in the dietpi user data location, which can be changed:
- http://dietpi.com/phpbb/viewtopic.php?f=8&t=478#p2087
- And also in dietpi-drive_manager

I've created a ticket, we'll look at also including MySQL DB's as user data:https://github.com/Fourdee/DietPi/issues/672
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
juliuscaesar

Re: Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

Thank you, i will look into that!

It also seems that my USB Harddrive is not reachable from time to time, i think it has to do with some setting like hdd spindown. Is it possible to change that setting somewhere so that the usb harddrive is always active and running?
juliuscaesar

Re: Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

Just to fill on the issue i'm getting.

Nextcloud login page is now stating:

" Data directory (/mnt/dietpi_userdata/nextcloud_data) is invalid
Please check that the data directory contains a file ".ocdata" in its root "
nwcatalyst

Re: Possible to get nextcloud to run from USB-harddrive?

Post by nwcatalyst »

you can literally just create a simple text file in that directory named .ocdata

it sounds like you didn't migrate the contents of your old nextcloud-data folder to the new one - try copying all the files/folders from the old location to the new, including hidden files/folders.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Possible to get nextcloud to run from USB-harddrive?

Post by Fourdee »

juliuscaesar wrote:Thank you, i will look into that!

It also seems that my USB Harddrive is not reachable from time to time, i think it has to do with some setting like hdd spindown. Is it possible to change that setting somewhere so that the usb harddrive is always active and running?
Yep, Disable the following from /etc/hdparm.conf:

Code: Select all

#DietPi external USB drive. Power management settings.
/dev/sda {
        #10 mins
        spindown_time = 120

        #
        apm = 254
}
" Data directory (/mnt/dietpi_userdata/nextcloud_data) is invalid
Please check that the data directory contains a file ".ocdata" in its root "
Strange, did you transfer the userdata location using dietpi-drive_manager or dietpi-software?

Lets check current userdata locations and contents, please paste results:

Code: Select all

ls -lha /mnt/dietpi_userdata
ls -lha /mnt
If your USB drive is attached, please also run:

Code: Select all

ls -lha /mnt/usb_1
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
juliuscaesar

Re: Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

1. ls -lha /mnt/dietpi_userdata gave the following:

Code: Select all

lrwxrwxrwx 1 root root 10 Dec 28 10:38 /mnt/dietpi_userdata -> /mnt/usb_1
2. ls -lha /mnt:

Code: Select all

total 40K
drwxr-xr-x 10 root root 4.0K Dec 28 10:38 .
drwxr-xr-x 20 root root 4.0K Dec 28 10:35 ..
lrwxrwxrwx  1 root root   10 Dec 28 10:38 dietpi_userdata -> /mnt/usb_1
drwxr-xr-x  2 root root 4.0K Nov  1 16:50 ftp_client
drwxr-xr-x  2 root root 4.0K Nov  1 16:47 nfs_client
drwxr-xr-x  2 root root 4.0K Nov  1 16:50 samba
drwxrwxr-x  9 root root 4.0K Dec 28 10:53 usb_1
drwxr-xr-x  2 root root 4.0K Dec 28 10:35 usb_2
drwxr-xr-x  2 root root 4.0K Dec 28 10:35 usb_3
drwxr-xr-x  2 root root 4.0K Dec 28 10:35 usb_4
drwxr-xr-x  2 root root 4.0K Dec 28 10:35 usb_5
3. ls -lha /mnt/usb_1:

Code: Select all

total 101M
drwxrwxr-x  9 root     root     4.0K Dec 28 10:53 .
drwxr-xr-x 10 root     root     4.0K Dec 28 10:38 ..
drwxrwxr-x  2 root     root     4.0K Dec 28 10:38 downloads
drwxrwxr-x  2 root     root      16K Dec 28 10:35 lost+found
drwxrwxr-x  2 root     root     4.0K Dec 28 10:38 Music
drwxrwx---  5 www-data www-data 4.0K Dec 28 11:10 nextcloud_data
drwxrwxr-x  2 root     root     4.0K Dec 28 10:38 Pictures
-rwxrwxr-x  1 root     root     100M Dec 28 10:38 .swapfile
drwxrwxr-x  6 urbackup urbackup 4.0K Jan  1 21:12 urbackup
drwxrwxr-x  2 root     root     4.0K Dec 28 10:38 Video
Strange, did you transfer the userdata location using dietpi-drive_manager or dietpi-software?
Yes i did change dietpi to use usb-harddrive instead of sd-card even before installing Nextcloud. Maybe it has been installing it some on the harddrive and some of the sdcard because of the spindown?

I tried the ls -lha /mnt/usb_1 again after waiting to see if the spindown has taken effect. And i now get:

Code: Select all

root@DietPi-cloud:~# ls -lha /mnt/usb_1
ls: reading directory /mnt/usb_1: Input/output error
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Possible to get nextcloud to run from USB-harddrive?

Post by Fourdee »

Hi, data locations look fine and expected folders in usb_1 exist.
juliuscaesar wrote: I tried the ls -lha /mnt/usb_1 again after waiting to see if the spindown has taken effect. And i now get:

Code: Select all

root@DietPi-cloud:~# ls -lha /mnt/usb_1
ls: reading directory /mnt/usb_1: Input/output error
I/O indicates a possible HDD failure at the basic level, even if there are filesystem errors, the IO is a major concern and the drive shouldn't be used for important files/data.
Was the drive spun down when you ran this command?

It could be a lack of power, especially if its a 2.5inch with USB power, make sure you have at least a 5v/2a PSU. Even then, it really needs to be an official PSU from RPi or Odroid for proven stability.

Might also be worth checking the drive for filesystem errors:

Code: Select all

fsck /dev/sda1 -f
Failing that, you'll need to check the SMART status of drive, should provide info on drive health:
https://www.howtoforge.com/checking-har ... ian-ubuntu
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
juliuscaesar

Re: Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

Fourdee wrote:Hi, data locations look fine and expected folders in usb_1 exist.
juliuscaesar wrote: I tried the ls -lha /mnt/usb_1 again after waiting to see if the spindown has taken effect. And i now get:

Code: Select all

root@DietPi-cloud:~# ls -lha /mnt/usb_1
ls: reading directory /mnt/usb_1: Input/output error
I/O indicates a possible HDD failure at the basic level, even if there are filesystem errors, the IO is a major concern and the drive shouldn't be used for important files/data.
Was the drive spun down when you ran this command?

It could be a lack of power, especially if its a 2.5inch with USB power, make sure you have at least a 5v/2a PSU. Even then, it really needs to be an official PSU from RPi or Odroid for proven stability.

Might also be worth checking the drive for filesystem errors:

Code: Select all

fsck /dev/sda1 -f
Failing that, you'll need to check the SMART status of drive, should provide info on drive health:
https://www.howtoforge.com/checking-har ... ian-ubuntu

Yes the HDD was probably spun down when i ran the command, even though i disabled the settings in hdparm.conf.
I will check the power supply and see if it provides too little power to run the rpi 3 + usb hdd, thanks!

I reinstalled Nextcloud to make sure that all the files are on the USB HDD.

I will let you know how it goes, thanks for all your help!
juliuscaesar

Re: Possible to get nextcloud to run from USB-harddrive?

Post by juliuscaesar »

I uninstalled Nextcloud and disabled the hdparm.conf line as you recommended, it has been working now without any issues for several hours!
I will let you know if this changes.

Thank you so very much for all the help!!
Post Reply