I am wondering how to check if a directory (on my RaspberryPi) is on an external drive or not.
I think I mounted my WD MyPassport correctly, and was able to write to it via /media/pi/MyPassport. However, something happened and it created a MyPassport1 folder, which seemed to actually be the external drive. So I have /media/pi/MyPassport and /media/pi/MyPassport1 when the external is connected.
I removed my external drive and still can see (and access/read/write) to /media/pi/MyPassport...so something happened that moved the external directory, and created /media/pi/MyPassport locally.
I'd like to include in the script I have that copies data to MyPassport to first check if /media/pi/MyPassport is indeed on an external drive, before copying.
Is that possible?
Edit: I know, now, that the external drive is called .../MyPassport1, so could just see if that directory exists, then keep copying...but I'm asking more generally, is there a way to check if a directory is indeed an external drive connected via USB?
df -h /media/pi/Passport1, when USB is mounted./dev/sda1. When I run that command on/media/pi/"My Passport", it's/dev/root. I have been learning about Unix and see thatsda1refers to an external drive, correct? (I know/dev/rootis the root file system, aka local).