61.23 Nextcloud Move Data Directory

20170918

If Nextcloud is having trouble uploading my photos or files in general, check if the Nextcloud server’s disk is full. Typically an installation is located at /var/www/nextcloud. Note that the sum of the disk usage across all users might be much less than the actual reported utilisation of disk:

$ du -sh /var/www/nextcloud/data/*
36G   /var/www/nextcloud/data/

Nextcloud maintains backups and previous versions of documents.

If storage has become full then one option (apart from deleteing backups and versions as discussed in Section @ref(sec:nextcloud_trash)) is to move the another folder on another storage device.

Suppose another volume is available. First format it then mount it:

$ sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_volume-sgp1-01 

$ sudo mkdir -p /mnt/volume-sgp1-01

$ sudo mount -o discard,defaults \
             /dev/disk/by-id/scsi-0DO_Volume_volume-sgp1-01 \
             /mnt/volume-sgp1-01 

$ echo /dev/disk/by-id/scsi-0DO_Volume_volume-sgp1-01 \
       /mnt/volume-sgp1-01 ext4 defaults,nofail,discard 0 0 |
  sudo tee -a /etc/fstab

Now move the data to this new disk and create a symbolic link from the old location /var/www/nextcloud/data:

$ occ maintenance:mode --on
$ sudo rsync -vazh /var/www/nextcloud/data/ \
                   /mnt/volume-sgp1-01/nextcloud_data_backup_20170918/ 
$ sudo mv /var/www/nextcloud/data /mnt/volume-sgp1-01/nextcloud_data
$ sudo ln -s /mnt/volume-sgp1-01/nextcloud_data /var/www/nextcloud/data
$ occ maintenance:mode --off

Files might not be available through the GUI immediately. Try a reboot to get things working again. If Nextcloud comes up in singleuser mode so:

$ occ maintenance:singleuser --off

References



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0