2

I have a monthly limited connection at home, so I keep a RPI 3B at my grandparents' house since they have an unlimited connection and I swing by often. I have it functioning as sort of a download machine with (currently) only Deluge and uGet installed and I operate it via VNC Server. Logically, I have it connected to a hard drive where I keep everything.

I've used a WD My Passport 2TB hard drive for about 3 years now and everything has worked fine since I started all this, up until recently. The hard drive is named simply as "X", I have Deluge set up to download torrents directly onto it but recently this weird thing has been happening.

Basically, when I access /media/pi there are 2 drives instead of one: one of them is X, the other is called X1 and I have no idea where it came from but it is the same drive. If I save anything onto X, it pops up on X1 too, you get the idea. The real problem here is the fact that df on the terminal, tells me X has 9GB in size whereas X1 has around 1.8TB, this is a bit of a hassle and a mess but if I ignored it would be fine (in theory), the problem is, when I plug the hard drive into my Windows PC at home, Windows has a ton of problems trying to read the drive, I can't even access it since I get a X: is not accessible message. I've run chkdsk on it to try and fix it (to no avail), I've formatted it in many ways, many times and nothing seems to work, even though the RPI has no trouble accessing the hard drive.

Also, before anyone mentions it, it's not a partition issue. I've never partitioned this drive and I've checked with the disk managers on both Windows and Raspbian and all of the available space is attributed to one NTFS volume. (I'm running Raspbian Buster)

I appreciate any help and thank you in advance, I can supply more info if it's required.

1 Answer 1

2

You DO NOT have 2 drives, you probably have 2 mount points, one of which may have a drive mounted on it.

The automount "feature" creates mount points, and can create many if drives are re-attached without properly unmounting - there are many reasons this can occur.

If you attempt to write, without checking that a drive is mounted, you will write to the mount point, preventing its use.

I turn off the automount "feature" and create /etc/fstab entries for my drives, and always check that the drive is mounted before writing. One example is below (this is for a network drive, but the principle is the same).

#!/bin/bash
# 2019-11-02

IMAGE_MOUNT='/mnt/Image'

# Check/create Mount Points
if [ ! -e $IMAGE_MOUNT ]; then
    mkdir $IMAGE_MOUNT
fi

# Check/mount image
BACKUPIMAGE=$IMAGE_MOUNT'/'$BACKUPNAME
if [ ! -e $BACKUPIMAGE ]; then
    sudo mount.cifs //Milliways.local/Images /mnt/Image -o user=ian
fi

To unmount a drive in GUI there is an eject button (which only shows if there are mounted drives).

sudo umount /media/pi/X 

will unmount anything at that mount point, and

sudo rm -rf /media/pi/X 

will delete the mount point and all files. (Obviously only run this with the drive unmounted.)

PS the findmntutility is a handy tool for working with mounts.

1
  • I am by no means an expert Unix user, I'm a bit above average at best. So my plan of action now should be to correctly unmount my drive, clear all the mount points and then replug it and mount it, right? If so, how should I proceed to clear the mount points?
    – zeval
    Jan 11, 2020 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.