Change to using old data on external harddrive

Hi,
I had to do a new install of DietPi, as my SD card died. I have installed DietPi on to a new USB stick with Nextcloud. The install of DietPi (on the now dead SD with Dietpi 9.0.2) was set up to use and external harddrive to save Nextcloud settings and data. I would like to set up the new install of DietPi (on the new USB stick) to use the external harddrive and “old” data to set up Nextcloud. I do not want to write over any data that is on the external harddrive.

I have searched the existing open and closed issues but not found a clear explanation on how to do this-

Required Information

  • DietPi version = v9.1.1
  • Distro version = Bookworm
  • Kernel version = 6.1.21-v8+
  • Architecture = arm64
  • SBC model = RPi 4 Model B (aarch64)
  • Power supply used | EG: 5V 1A
  • USB stick used 64Gb

Additional Information

  • Software title Nextcloud
  • Fresh install of Dietpi

Please could you help. I am a relative noobie to dietpi. Thank you!

do you recall how your HDD was connected before? Did you moved /mnt/dietpi_userdata/ to that external drive last time?

Hi, yes, I believe I did… though it was a while ago :upside_down_face:

Nextcloud is already installed on your system?

Yes, it is.

can you share following

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
ls -la /mnt
NAME FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                58.6G  0 disk                                                 
├─sda1
│    vfat           128M  0 part /boot      aeecd9eb-01                          4E17-76D0
└─sda2
     ext4          58.5G  0 part /          aeecd9eb-02                          58ad7a5b-ca2e-47e7-afa3-88d78fff92fd
sdb               698.6G  0 disk                                                 
└─sdb1
     ext4         698.6G  0 part            38ce59cf-01                          eb96183d-69ca-422f-a187-3f56d706faa0
total 24
drwxr-xr-x  7 root   root   4096 Feb 25 12:51 .
drwxr-xr-x 18 root   root   4096 Feb 20 00:17 ..
drwxrwxr-x 11 dietpi dietpi 4096 Feb 23 18:49 dietpi_userdata
drwxrwxr-x  2 dietpi dietpi 4096 Feb 19 23:34 ftp_client
drwxr-xr-x  2 root   root      0 Feb 25 14:24 hdd
drwxrwxr-x  2 dietpi dietpi 4096 Feb 19 23:35 nfs_client
drwxrwxr-x  2 dietpi dietpi 4096 Feb 19 23:35 samba

ok before we do anything, can we check what is inside the HDD folder and the current mount options

ls -la /mnt/hdd
cat /etc/fstab

Another wry question: Are your previous and current Debian and Nextcloud versions the same, i.e. was it a Bookworm image before and Nextcloud up-to-date?

uhh good point.

total 32
drwxrwx---  5 root   root    4096 Feb  7 11:49 .
drwxr-xr-x  7 root   root    4096 Feb 25 12:51 ..
drwxr-xr-x  3 root   root    4096 Feb  4 21:17 dietpi-backup
drwxrwxr-x 14 dietpi dietpi  4096 Jan 28 14:16 dietpi_userdata
drwx------  2 root   root   16384 Nov  7 08:58 lost+found
# 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=1922M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf, glusterfs, mergerfs, bind, Btrfs subvolume
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAP SPACE
#----------------------------------------------------------------


#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=aeecd9eb-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=aeecd9eb-01 /boot vfat noatime,lazytime,rw 0 2
UUID=eb96183d-69ca-422f-a187-3f56d706faa0 /mnt/hdd ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount

hi, the last version of DietPi I was using on the SD card was 9.0.2 I believe what ever version of debian that runs. As for Nextcloud I’m not sure, it would have been a recent release of it. Sorry

There is no direct relation between DietPi version and Debian version.

It seems that the dietpi_userdata directory was on the hard drive in the past. We can recreate this and link the directory manually. After that, there may be problems with NextCloud. In this case, we may have to adapt the database user to the new situation.

The problem is that I am not sure whether newer MariaDB gracefully migrates a database directory from an older MariaDB version, hence the question regarding Debian. Newer Nextcloud should migrate an older data directory well, but still it is safer to either assure the versions match 100% or otherwise migrate with a database dump, instead of the raw directory.

But I guess the old system/SD card is not available anymore? If so, it might still work all well, but if possible, better have a backup of this old dietpi_userdata directory.

To adjust the data directory link:

dietpi-services stop
mv /mnt/dietpi_userdata /mnt/dietpi_userdata_backup
ln -s /mnt/hdd/dietpi_userdata /mnt/dietpi_userdata
dietpi-services start

Then wait a second and check back database logs:

journalctl -u mariadb
1 Like

before doing any change, we could check MariaDB version from old database folder

/mnt/hdd/dietpi_userdata/mysql/mysql_upgrade_info

I now have two other problems;

  1. i booted down the DietPi on the raspberry pi 4, unpluggted the harddrive and plugged it into my raspberry pi 5, to get some data off of it and get this message:

This location could not be displayed. You do not have permissions necessary to view the contents of "eb96183d-69ca-422f-a187-3F5d706faa0

  1. With or with out this usb harddrive attached to Dietpi on the rp4 the dietpi won’t boot. And get messages like the image attached.

Help please :upside_down_face: :melting_face:

where do you see that message?

in ubuntu when I click on the drive in the file manager (see image)

ok you login to a desktop. Which user you are? Did you tried root user or sudo command?

Because the drive might be readable for user root only. You would need to check file system permission. But don’t change them on your HDD, otherwise you will have challenges on DietPi afterwards

I logged in as root on ubuntu and I could see the data on the drive.