Mount older HDD with data to data directory

Nextcloud version (eg, 20.0.5): 27.0.1
Operating system and version (eg, Ubuntu 20.04): Armbian 23.5.1
Apache or nginx version (eg, Apache 2.4.25): 2.4.57
PHP version (eg, 7.4): 8.2

I have question about using my older HDD, which I mounted in older NextcloudPi, and I would like to use same data from it to the newest instalation.

Folders and files from older HDD looks:

nashome@espressobin:/media/nextcloud$ ls -la
total 81748
drwxrwx---  9 www-data www-data     4096 May  6 14:07 .
drwxr-xr-x  4 nashome  nashome      4096 Jul 16 19:50 ..
drwxrwxr-x 10 www-data www-data     4096 Jan 16  2022 appdata_ocur9sok151p
-rwxrwxr-x  1 www-data www-data      542 Jan 16  2022 .htaccess
-rwxrwxr-x  1 www-data www-data        0 Jan 16  2022 index.html
drwxrwxr-x  2 www-data www-data    16384 Jul 24  2020 lost+found
drwxrwxr-x  7 www-data www-data     4096 Jun 26  2022 ncp
-rw-r-----  1 www-data www-data 83639347 May  2 22:17 nextcloud.log
-rwxrwxr-x  1 www-data www-data        0 Jan 16  2022 .ocdata
drwxrwxr-x  2 www-data www-data     4096 May  2 23:17 .opcache
drwxr-xr-x  4 www-data www-data     4096 Jan 16  2022 silva
drwxrwxr-x  3 www-data www-data    12288 May  2 22:08 tmp
drwxrwxr-x  7 www-data www-data     4096 Mar 21  2022 tomik
-rw-r--r--  1 www-data www-data      788 May  6 14:07 updater.log

and after new installation /var/www/nextcloud/data/ directory:

nashome@espressobin:/var/www/nextcloud/data$ ls -la
total 56
drwxr-x---  7 www-data www-data  4096 Aug  6 18:38 .
drwxr-x--- 15 www-data www-data  4096 Aug  6 16:10 ..
drwxr-xr-x 10 www-data www-data  4096 Aug  6 18:40 appdata_ocumi49myers
drwxr-xr-x  2 www-data www-data  4096 Aug  6 18:04 files_external
-rw-r--r--  1 www-data www-data   542 Aug  6 18:03 .htaccess
-rw-r--r--  1 www-data www-data     0 Aug  6 18:03 index.html
drwxr-xr-x  4 www-data www-data  4096 Aug  6 18:35 ncp
-rw-r-----  1 www-data www-data 17194 Aug  6 18:36 nextcloud.log
-rw-r--r--  1 www-data www-data     0 Aug  6 18:03 .ocdata
drwxr-xr-x  3 www-data www-data  4096 Aug  6 18:36 tmp
drwxr-xr-x  2 www-data www-data  4096 Aug  6 18:38 tomik

I would like to use older HDD to mount it again, to the fresh Nextcloud installation to /var/www/nextcloud/data
I just want to know, if NCP keeps data on older HDD, I hope it doesn’t delete it.
Or should I clean some files, directories to proper change?
Or how should I do it, in better way.
Thank you for your replies, guys.

as long as you only touch the datadirectory it should be fine. But please note that no file will be shown in your nc webinterface or any client if it is not listed in the nc database. There is no problem hanging in a old datadirectory to a new installation, as long as you have a dump of your old database. Otherwise open a terminal and tell nc to scan for new file with the corosponding php command according to official nc manual.

1 Like