USB External - Replaced [RESOLVED]

Hello,

I recall during setup of my DietPi that setting up the USB drive was a ‘one time thing’ that you couldn’t choose to do again later.

My USB drive went bad and now I have no idea if it was set up correctly. I replaced the drive, and when using the diet-pi backup, it had me re-initialize the USB drive.

How do I know if my DietPi is set up to properly write as much as it can to the USB drive instead of creating unnecessary writes to the SD card? I spent days configuring things the way I want and would shudder to think I have to do it all over again…

Thank you for any help.

I recall during setup of my DietPi that setting up the USB drive was a ‘one time thing’ that you couldn’t choose to do again later.

As of v120, you can setup a USB drive at any time in dietpi-software > user data location.

When you restore from dietpi-backup, its effectively a system restore.
All files and settings are reverted back to when you made the backup. The only exclusions is data in /mnt. So USB drive data is not backed up. dietpi-sync can be used for that: (resolved) Cannot log in to the MySQL server

My USB drive went bad and now I have no idea if it was set up correctly. I replaced the drive, and when using the diet-pi backup, it had me re-initialize the USB drive.

How do I know if my DietPi is set up to properly write as much as it can to the USB drive instead of creating unnecessary writes to the SD card? I spent days configuring things the way I want and would shudder to think I have to do it all over again…

If you replaced your existing USB drive because it failed, and you did not copy/clone the whole contents to another USB drive, I would highly recommend you reinstall DietPi from scratch. Files and folders that installed programs expect will not exist and you will experience issues.

If you copied/cloned the USB drive to another one. You could of simply powered off the device, then swap the drives over :slight_smile:. However, as it sounds like you did a dietpi-backup restore, any software that was installed after that restore point will need to be reinstalled.

You can check the status of dedicated USB drive in DietPi with:

cat /DietPi/dietpi/.installed | grep USBDRIVE # if this is =2, it means a USB drive was setup by the user
readlink /mnt/dietpi_userdata # If this returns /mnt/usb_1, DietPi is currently using the USB drive for your user data

This is EXACTLY what I wanted. Thank you so much! For anybody who wants to set up a little script for what Fourdee supplied, here is a quick one I threw together:

nano /root/checkusb

Copy the following text and paste.

printf "\n################\nUSB Drive Status\n\n"
cat /DietPi/dietpi/.installed | grep USBDRIVE # if this is =2, it means a USB drive was setup by the user
readlink /mnt/dietpi_userdata # If this returns /mnt/usb_1, DietPi is currently using the USB drive for your user data
printf "################\n\n"
printf "If line one =2, it means a USB drive was setup by the user\n"
printf "If line two returns: /mnt/usb_1\n Then it means DiePi is currently using the USB drive for your user data.\n\n"

Exit/save with CTRL+X, Y, Enter.

chmod +x /root/checkusb

Run it with

/root/CustomScripts/checkusb

Nice one, thanks for sharing :slight_smile:

root@DietPi:~# ./test

################
USB Drive Status

USBDRIVE=2
/mnt/usb_1
################

If line one =2, it means a USB drive was setup by the user
If line two returns: /mnt/usb_1
 Then it means DiePi is currently using the USB drive for your user data.

I just suffered the same and I’m considering reinstalling from scratch. Tried to look for confirmation in github and the forum, but couldn’t find any relevant.
What exactly userdata contains? (meaning, what critical dietpi/system info did I lost when the external drive stopped working?)
Thx, Wolf

Hi Wolf,

In short, all DietPi related settings are stored on SD (/boot).

The majority of program settings are stored in their default locations (eg: /etc).

User data is essentially “data storage” for Music, Video, Downloads etc.

More info here: https://dietpi.com/forum/t/dietpi-software-user-data/400/1

Perfect, thanks @Fourdee. So my understanding is the system should perform stable aside from not finding media or other content files, no other impact expected.
Thanks again!

PS: Thx for the link, it doesn’t show up as relevant on the search (due to words being so common) so maybe is worthy if you edit it and add keywords like “userdata”