Removed hard drive without unmounting, now it won't re-mount to original path where user data sits

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
thisisdanni
Posts: 4
Joined: Tue Sep 04, 2018 12:25 pm

Removed hard drive without unmounting, now it won't re-mount to original path where user data sits

Post by thisisdanni »

I stupidly unplugged my external hard drive (containing the user data folder) from my Pi without first unmounting.

Without the hard drive being mounted, the drive manager still displays the user data path as it was when the hard drive was connected. Therefore, when I try to remount the drive the path conflicts as it interprets the path to already be in use (see screenshots below).

1. Hard drive detected but not mounted
Image


2. Attempting to mount hard drive to it's automatically assigned path
Image


3. Cannot mount as it conflicts with already assigned user data path
Image


I can mount it by giving it a new custom path, however I can't transfer the user data across to the drive as it obviously can't connect to what it thinks is the current user data location.

Am I able to manually edit the user data location path? I'm guessing it's located in a text file somewhere. That way I can re-mount my hard drive to a custom path and then edit the user data location to match, hopefully solving my issue.

I'd like to avoid a clean install if possible. Any tips appreciated!
User avatar
WarHawk
Posts: 606
Joined: Thu Jul 20, 2017 8:55 am

Re: Removed hard drive without unmounting, now it won't re-mount to original path where user data sits

Post by WarHawk »

You might need run fsck on the device and see if drive might be borked up and fix it

https://www.thegeekstuff.com/2012/08/fs ... d-examples

Ah wait...use the check & repair option right below the mount option

Image
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Removed hard drive without unmounting, now it won't re-mount to original path where user data sits

Post by MichaIng »

Jep fsck makes sense anyway and can only be done before mounting.

But the issue itself is the still existing mount location folder. Just remove it, it should be empty.

Code: Select all

rmdir /mnt/38EA0C5AEA0C1732
The command throws an error, if the folder is not empty. In case check the content, but as it is drive mount target, it should be empty.

Alternatively you can mount the drive manually:

Code: Select all

mount /dev/sda2 /mnt/38EA0C5AEA0C1732
Afterwards start dietpi-drive_manager to let it (re)write the mount to fstab (so it is mounted automatically on boot).

This is a dietpi-drive_manager specific issue. When you unmount a drive via drive manager, it removes the mount point directory. If you don't unmount it, or use umount directly from terminal, the dir stays in place. For accident prevention, drive manager just allows to mount to non-existing folders and pre-creates them in case.

To have this handier, I will add the option to ignore folder existence and mount the drive anyway, if the folder is empty at least. If the folder is not empty, you will have the option (with big warning that you should know what you do!) to backup the existing folder+content to allow the drive mount.

€: I opened a feature request on GitHub, so will be not forgotten and bring it to Fourdees attention as well: https://github.com/Fourdee/DietPi/issues/2056
Should make it into v6.15 :).
thisisdanni
Posts: 4
Joined: Tue Sep 04, 2018 12:25 pm

Re: Removed hard drive without unmounting, now it won't re-mount to original path where user data sits

Post by thisisdanni »

Thanks WarHawk and MichaIng for your help! I actually ended up doing a fresh install the next morning as after further tinkering I thought it might be a lost cause. Thanks for raising a ticket about this. I'll be sure to bookmark this for future reference (though hopefully I won't need it!).
Post Reply