USB External - Replaced [RESOLVED] Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
brenkuu

USB External - Replaced [RESOLVED]

Post by brenkuu »

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.
Last edited by brenkuu on Tue Jul 05, 2016 12:56 pm, edited 1 time in total.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: USB External - Replaced

Post by Fourdee »

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.
brenkuu wrote:I replaced the drive, and when using the diet-pi backup, it had me re-initialize the USB drive.
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: http://dietpi.com/phpbb/viewtopic.php?f ... rt=30#p256
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 :). 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:

Code: Select all

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
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
brenkuu

Re: USB External - Replaced

Post by brenkuu »

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:

Code: Select all

nano /root/checkusb
Copy the following text and paste.

Code: Select all

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.

Code: Select all

chmod +x /root/checkusb
Run it with

Code: Select all

/root/CustomScripts/checkusb
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: USB External - Replaced

Post by Fourdee »

brenkuu wrote:here is a quick one I threw together:

Code: Select all

nano /root/checkusb
Copy the following text and paste.

Code: Select all

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.

Code: Select all

chmod +x /root/checkusb
Run it with

Code: Select all

/root/CustomScripts/checkusb
Nice one, thanks for sharing :)

Code: Select all

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.

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Wolfgan
Posts: 16
Joined: Tue May 31, 2016 10:56 pm

Re: USB External - Replaced [RESOLVED]

Post by Wolfgan »

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
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: USB External - Replaced [RESOLVED]

Post by Fourdee »

Wolfgan wrote:What exactly userdata contains? (meaning, what critical dietpi/system info did I lost when the external drive stopped working?)
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: http://dietpi.com/phpbb/viewtopic.php?f=8&t=478#p2087
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Wolfgan
Posts: 16
Joined: Tue May 31, 2016 10:56 pm

Re: USB External - Replaced [RESOLVED]

Post by Wolfgan »

Fourdee wrote:
Wolfgan wrote:What exactly userdata contains? (meaning, what critical dietpi/system info did I lost when the external drive stopped working?)
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: http://dietpi.com/phpbb/viewtopic.php?f=8&t=478#p2087
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"
Post Reply