Replacing USB drive for Nextcloud

Having issues with your DietPi installation or found a bug? Post it here.
Tox
Posts: 9
Joined: Sun Jan 03, 2021 2:59 pm

Replacing USB drive for Nextcloud

Post by Tox »

Hello,
I have follow this tuto: https://www.youtube.com/watch?v=lSRoJIrt13Y for installing Nextcloud with Dietpi. As I wanted to test it for a while I have connect a USB stick before having a bigger HDD. Everything is working fine but now I would like to replace my USB stick by a USB HDD drive. I also would like to keep the actual files stored on the USB stick. Do someone knows how to do so ?
Data are actually saved under /mnt/dietpi_userdata/nextcloud_data.
Regards.
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: Replacing USB drive for Nextcloud

Post by Joulinar »

Hi,

did you stored your entire dietpi-user data on the USB stick?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Tox
Posts: 9
Joined: Sun Jan 03, 2021 2:59 pm

Re: Replacing USB drive for Nextcloud

Post by Tox »

hi Joulinar,
not sure about that, how can I check ?
Tox
Posts: 9
Joined: Sun Jan 03, 2021 2:59 pm

Re: Replacing USB drive for Nextcloud

Post by Tox »

As mentioned in viewtopic.php?t=478 :

Code: Select all

root@DietPi:~# readlink -f /mnt/dietpi_userdata
/mnt/dietpi_userdata

Code: Select all

root@DietPi:~# df /mnt/dietpi_userdata
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       61116684 1637228  56971888   3% /

Code: Select all

root@DietPi:~# df /mnt/dietpi_userdata/nextcloud_data
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda1      119266264 24428236  94821644  21% /mnt/dietpi_userdata/nextcloud_data
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: Replacing USB drive for Nextcloud

Post by Joulinar »

did you installed your entire system on that USB stick?

can you share lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Tox
Posts: 9
Joined: Sun Jan 03, 2021 2:59 pm

Re: Replacing USB drive for Nextcloud

Post by Tox »

Hi,
No this tutorial interested me because only the data were stored on an external drive.

Code: Select all

root@DietPi:~# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
NAME       FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                     116.1G  0 disk
└─sda1     ext4         116.1G  0 part /mnt/dietp 02c06ec7-01                          f00aa157-7137-4087-a1e9-1b491750e891
mmcblk0                  59.5G  0 disk
├─mmcblk0p1
│          vfat   boot    256M  0 part /boot      907af7d0-01                          4AD7-B4D5
└─mmcblk0p2
           ext4   rootfs
                         59.2G  0 part /          907af7d0-02                          2887d26c-6ae7-449d-9701-c5a4018755b0
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: Replacing USB drive for Nextcloud

Post by Joulinar »

ah ok you mounted the USB stick directly to /mnt/dietpi_userdata/nextcloud_data

Let's verify to be sure :) cat /etc/fstab
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Tox
Posts: 9
Joined: Sun Jan 03, 2021 2:59 pm

Re: Replacing USB drive for Nextcloud

Post by Tox »

Code: Select all

root@DietPi:~# cat /etc/fstab
# You can use "dietpi-drive_manager" to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------


#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=1938M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAPFILE
#----------------------------------------------------------------


#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=907af7d0-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=907af7d0-01 /boot vfat noatime,lazytime,rw 0 2
UUID=f00aa157-7137-4087-a1e9-1b491750e891 /mnt/dietpi_userdata/nextcloud_data ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=c2b04798-8023-41df-bd1a-f9402db8f8bc /mnt/c2b04798-8023-41df-bd1a-f9402db8f8bc ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: Replacing USB drive for Nextcloud

Post by Joulinar »

ok it should be easy to copy all data to your new HDD
  1. connect your HDD to your system
  2. go to dietpi-drive_manager
  3. I assume your HDD is empty and we are going to format it before usage
  4. select the new HDD and check Format
  5. follow the dialog and mount the HDD to /mnt/hdd at the end
  6. leave dietpi-drive_manager
  7. run dietpi-services stop to stop all services
  8. let's check and install rsync
  9. run apt update && apt install rsync -y
  10. let's copy files now rsync -avH --progress /mnt/dietpi_userdata/nextcloud_data/ /mnt/hdd/
  11. now we need to switch disk and mount points. go to dietpi-drive_manager
  12. select your HDD and unmount the device
  13. select your USB stick and unmount the device
  14. hopefully this is working and both device are not in use/blocked
  15. if all is working well and both devices are not mounted anymore, select your HDD and mount it to /mnt/dietpi_userdata/nextcloud_data/
  16. leave dietpi-drive_manager
  17. run dietpi-services start to start all services
  18. if there are no error messages, NextCloud should be using data on HDD now.
  19. do a reboot and removed the USB stick
  20. check inside NextCloud if you are able to access/store/remove data
    Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
    Tox
    Posts: 9
    Joined: Sun Jan 03, 2021 2:59 pm

    Re: Replacing USB drive for Nextcloud

    Post by Tox »

    thank you Joulinar, i can not have access to the system today, i will test it tomorrow and let you know. thank you anyway for your help.
    Post Reply