# USB External - Replaced \[RESOLVED\]

**URL:** https://dietpi.com/forum/t/usb-external-replaced-resolved/440
**Category:** Troubleshooting
**Created:** [5 July 2016 09:51 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440 "2016-07-05T09:51:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![brenkuu](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@brenkuu](https://dietpi.com/forum/u/brenkuu)
#### Post date: [5 July 2016 09:51 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/1 "2016-07-05T09:51:28Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Fourdee](https://dietpi.com/forum/user_avatar/dietpi.com/fourdee/32/11_2.png) [@Fourdee](https://dietpi.com/forum/u/Fourdee)
#### Post date: [5 July 2016 10:38 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/2 "2016-07-05T10:38:43Z")

</div>

> 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](#):
>
> 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: [(resolved) Cannot log in to the MySQL server](https://dietpi.com/forum/t/resolved-cannot-log-in-to-the-mysql-server/41/1)

> 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:

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![brenkuu](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/a6a055/32.png) [@brenkuu](https://dietpi.com/forum/u/brenkuu)
#### Post date: [5 July 2016 10:55 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/3 "2016-07-05T10:55:58Z")

</div>

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:

```nohighlight
nano /root/checkusb

```

Copy the following text and paste.

```nohighlight
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.

```nohighlight
chmod +x /root/checkusb

```

Run it with

```nohighlight
/root/CustomScripts/checkusb

```

---

<div class="post-metadata">

### Author: ![Fourdee](https://dietpi.com/forum/user_avatar/dietpi.com/fourdee/32/11_2.png) [@Fourdee](https://dietpi.com/forum/u/Fourdee)
#### Post date: [5 July 2016 15:08 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/4 "2016-07-05T15:08:56Z")

</div>

> [@brenkuu](#):
>
> here is a quick one I threw together:
> 
> ```plaintext
> nano /root/checkusb
> 
> ```
> 
> Copy the following text and paste.
> 
> ```plaintext
> 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.
> 
> ```plaintext
> chmod +x /root/checkusb
> 
> ```
> 
> Run it with
> 
> ```plaintext
> /root/CustomScripts/checkusb
> 
> ```

Nice one, thanks for sharing 🙂

```plaintext
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.

```

---

<div class="post-metadata">

### Author: ![Wolfgan](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wolfgan](https://dietpi.com/forum/u/Wolfgan)
#### Post date: [8 November 2016 18:45 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/5 "2016-11-08T18:45:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Fourdee](https://dietpi.com/forum/user_avatar/dietpi.com/fourdee/32/11_2.png) [@Fourdee](https://dietpi.com/forum/u/Fourdee)
#### Post date: [9 November 2016 12:02 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/6 "2016-11-09T12:02:27Z")

</div>

> [@Wolfgan](#):
>
> 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: [https://dietpi.com/forum/t/dietpi-software-user-data/400/1](https://dietpi.com/forum/t/dietpi-software-user-data/400/1)

---

<div class="post-metadata">

### Author: ![Wolfgan](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wolfgan](https://dietpi.com/forum/u/Wolfgan)
#### Post date: [9 November 2016 13:30 UTC](https://dietpi.com/forum/t/usb-external-replaced-resolved/440/7 "2016-11-09T13:30:02Z")

</div>

> [@Fourdee](#):
>
> > [@Wolfgan](#):
> >
> > 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: [https://dietpi.com/forum/t/dietpi-software-user-data/400/1](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”
