Offial procedure to substiture external storage?

Greetings,
I am looking for the official documentation and procedure to change my Nextcloud external USB HD storage. (now to small in size)
I did receive some tips and ideas how to do that(cloing/restoring HD or copying file structure to a bigger one).
But what is the official procedure?
INFO:
Old HD 1T external HD
New HD: 4T WD Red
Thank you

Do you use the old HD as “external storage” (local, smb, ftp, …) or is it your primary storage defined in config/config.php ? Please post parts of config/config.php for more details.

primary storage.
What part of my config.php you would like to see?
‘datadirectory’ => ‘/media/<cloud_name>/ncdata’
(cloud_name is the name I have).

I think you should use the same file system on the new HD and copy all files in the new structure. Then you mount the New HD on the old position an then “rescan” all.

You can also mount it on another position, change config/config.php and then rescan.

sudo -u www-data php occ files:scan --all

files:scan rescan filesystem

https://docs.nextcloud.com/server/18.0.0/admin_manual/configuration_server/occ_command.html

1 Like

If you simply change data directory in config.php, you will meet this nice feature/bug Files amount after moving of data directory is wrong (much bigger). Here was some hints already how to proceed: Replace data hard disk

Thanks
it would be the same path. nothing changed in the config.php.
The only thing would be the size and the disk ID that changes.
I dont change location or paths.
Would that make things easier? Maybe could only rescan all be sufficient?
If I format the disk same FS and copy the file structure back to it, is enough?
Of I really have to clone and restore disk?
Thanks

For NC FS has no matter, as soon as you OC can use it it is ok. Also if path remains the same, you do not need to reconfigure anything. Just stop the server, move files to the new location/hdd, remount new location/hdd, check that path is correct and permissions were not vanished - and start the server.

@gas85
ok, I will give it a go.
Can you tell me how too check for permissions?
And I believe the path cannot go wrong.
I use NCP. Maybe the option: ‘Fix permissions for NC data files’ can help?

Sorry, not familiar with it.
Under Linux usually you can see permissions with e.g. ls

# ls -la /var/www/nextcloud/
total 160
drwxr-xr-x 13 www-data www-data  4096 Apr 30 15:58 .
drwxr-xr-x 10 root     root      4096 Apr 24 21:41 ..
-rw-r--r--  1 www-data www-data  2629 Apr 30 15:58 .htaccess
-rw-r--r--  1 www-data www-data   101 Apr 30 15:58 .user.ini
drwxr-xr-x 33 www-data www-data  4096 Apr 30 15:58 3rdparty
-rw-r--r--  1 www-data www-data 15752 Apr 30 15:58 AUTHORS
-rw-r--r--  1 www-data www-data 34520 Apr 30 15:58 COPYING
drwxr-x--- 72 www-data www-data  4096 May  5 14:14 apps
drwxr-x---  2 www-data www-data  4096 May  6 11:06 config
-rw-r--r--  1 www-data www-data  3910 Apr 30 15:58 console.php
drwxr-xr-x 23 www-data www-data  4096 Apr 30 15:58 core
-rw-r--r--  1 www-data www-data  5048 Apr 30 15:58 cron.php
-rw-r--r--  1 www-data www-data   156 Apr 30 15:58 index.html
-rw-r--r--  1 www-data www-data  2976 Apr 30 15:58 index.php
drwxr-xr-x  6 www-data www-data  4096 Apr 30 15:58 lib
-rw-r--r--  1 www-data www-data   283 Apr 30 15:58 occ
drwxr-xr-x  2 www-data www-data  4096 Apr 30 15:58 ocm-provider
drwxr-xr-x  2 www-data www-data  4096 Apr 30 15:58 ocs
drwxr-xr-x  2 www-data www-data  4096 Apr 30 15:58 ocs-provider
-rw-r--r--  1 www-data www-data  3056 Apr 30 15:58 public.php
-rw-r--r--  1 www-data www-data  5235 Apr 30 15:58 remote.php
drwxr-xr-x  4 www-data www-data  4096 Apr 30 15:58 resources
-rw-r--r--  1 www-data www-data    26 Apr 30 15:58 robots.txt
-rw-r--r--  1 www-data www-data  2381 Apr 30 15:58 status.php
drwxr-x---  3 www-data www-data  4096 Apr 30 15:58 themes
drwxr-x---  2 www-data www-data  4096 Aug 16  2019 updater
-rw-r--r--  1 www-data www-data   362 Apr 30 15:58 version.php

I would recommend to user ether rsync with key -a or -pr

rsync -a /source/folder/on/1TB /destination/folder/on/4TB

or cp with key -Rp

cp -Rp /source/folder/on/1TB /destination/folder/on/4TB

This will keep current permissions during the copy to the new drive. In this case it will be better to keep the same FS, e.g. ext4, and not ntfs or FAT32 :grin:

Greetings,
so, here is my successful (so far so good) procedure:
Preface:
I had a 1TB usb disk as my only storage (external storage)
New disk: 4TB WD red NAS disk
Actions:
downloaded clonezilla live on a usb key.
booted on the key and started the clonezilla.
at first I had a failure as (of course) the 1TB disk was an MBR.
Once I figure that out, I first used gparted to create a partition table on the 4TB disk. than (probably useless) I also formatted the disk on ext4.
Restarted Clonezilla with the old and new disk attached.
Chose the device to device option,
Entered advanced options and unchecked the copy of the hidden data between BMR and first partition (-j2).
Started cloning.
Success.
Resinsterted the new disk on the Pi USB and looks like I have no issues at all. no need to fix anything.
I am glad to see that the procedure was very simple after all.
Thanks to @devnull and @gas85 that actually helped me to get to the right direction.
PS @gas85 NCP is Nextcloud on the raspberry pi.

1 Like