Sorry for necro but as I encountered this issue and this was one of the areas i found some help Ill go through my process.
For me, I encountered the issue of the /DietPi/ folder being empty after a reboot. The SD card was also read only. I tested this by simply doing
touch /etc/samba/smb.conf
as this was one of the files i knew was still there. Seeing it was read only i did
mount -o remount, rw /
This made me able to edit files again. After this came the problem of not having any dietpi-drive_manager or any of those. I did download them manually but dont do that. I did wget to get them.
wget https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/dietpi-drive_mana ger -O /DietPi/dietpi/dietpi-drive_manager
then manually ran it with
. /DietPi/dietpi/dietpi-_drive_manager
then ran
. /DietPi/dietpi/dietpi-drive_manager 4
but that cleared out everything I had manually downloaded in the /DietPi folder
the problem apparently was in fstab. there was an issue with the mounting of the boot partition. Potentially linked to dietpi-drive_manager and unmounting of an external harddrive
So the first thing I did was remove x-systemd.automount because some part of the internet hinted me to it. rebooted and it was still borked. Next what actually fixed it was turning it from this
#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=xxxxxxf7-02 / ext4 noatime,lazytime,rw 0 1
UUID=xxx1-xxxB /media/root/boot vfat noatime,lazytime,rw,nofail,noauto,x-systemd.automount
into this
#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=xxxxxxf7-02 / ext4 noatime,lazytime,rw 0 1
UUID=xxx1-xxxB /boot vfat noatime,lazytime,rw 0 2
Meaning i removed /media/root/boot and made it only /boot, also copied the top row to look like the bottom row. this was because i based this of another fstab from another one of my servers. After this I rebooted and was greeted by the good old dietpi loginscreen. and fstab was back to nromal like below
#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=xxxxxxf7-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=xxxxxxf7-01 /boot vfat noatime,lazytime,rw 0 2
I dont know what caused it, I think everything went to shit when I was unable to unmount an ext hdd and I just shut the pi down and unplugged instead. No boot stuff was related to the drive afaik.