SOLVED How to refer to a Hard Drive

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Ken Kloster
Level 1
Level 1
Posts: 6
Joined: Fri Jul 06, 2018 8:21 pm

SOLVED How to refer to a Hard Drive

Post by Ken Kloster » Sun Jul 15, 2018 8:51 pm

07/15/18

I have a question I can't believe nobody has ask..

I have very recently converted from Windows XP to Linux Mint. I dable in writing code in C++ and Java. When I copied all of my programs from the Windows machine to the Linux machine none of them would run because the code could not find the files I was calling for.

I am used to calling for a file by referring to the drive as A:, C:, ... . This doesn't work in Linux. I tried to use the drive name (Kloster3) and that did not work. It appears that the reference for sub-directories (/Sub-directory1/Sub-directory2/...) is the same but not for drives.

What is th secret??

Ken
Last edited by Ken Kloster on Sun Jul 15, 2018 9:45 pm, edited 1 time in total.

gm10
Level 13
Level 13
Posts: 4598
Joined: Thu Jun 21, 2018 5:11 pm

Re: How to refer to a Hard Drive

Post by gm10 » Sun Jul 15, 2018 9:03 pm

Same as in Windows, devices need to be mounted to the file system to be accessible. Unlike in Windows, mount points cannot be driver letters, they are always directories. Think of the file system like a tree. One device gets mounted as the root /, all others branch off from that. See mount.

ajgringo619
Level 5
Level 5
Posts: 544
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: How to refer to a Hard Drive

Post by ajgringo619 » Sun Jul 15, 2018 9:08 pm

There are no "drives" in Linux, only directories and mount points. The "df" command shows all of the currently mounted partitions/devices:

[on my system]

Code: Select all

Filesystem      1K-blocks      Used Available Use% Mounted on
udev              8159748         0   8159748   0% /dev
tmpfs             1638148      1544   1636604   1% /run
/dev/sda5       407590568  48192424 338623952  13% /
tmpfs             8190732    120300   8070432   2% /dev/shm
tmpfs                5120         4      5116   1% /run/lock
tmpfs             8190732         0   8190732   0% /sys/fs/cgroup
tmpfs             8190732       376   8190356   1% /tmp
/dev/sda1           98304     28186     70118  29% /boot/efi
/dev/sda3       511282460  72217664 439064796  15% /media/Windows
/dev/sda6      1009204372  52561028 905309048   6% /home
/dev/sdc1        60040992  32108800  27932192  54% /media/me/USB_BOOT
/dev/sdb1       960348184 389369572 522125876  43% /media/me/Backup-Data
tmpfs             1638144        52   1638092   1% /run/user/1000
See the /dev/sdx references? Those refer to partitions on active devices (hard drive, SSD, USB, etc). The "Mounted on" label refers to where the partition's data resides in the file hierarchy. If you need to refer to a file in /home, you would use "/home/filename".
[Mint 19 XFCE, AMD FX-8350 Eight-Core w/16 GB RAM, 4.15.0-42-generic, GeForce GTX 960 w/Nvidia 415.18]
Image

User avatar
Pierre
Level 17
Level 17
Posts: 7695
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: How to refer to a Hard Drive

Post by Pierre » Sun Jul 15, 2018 9:29 pm

Hi Ken - the Linux System is indeed somewhat different from that Windows System,
but as others will tell you - - the move to a Linux System is definitely worth the effort.
8)
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

HaveaMint
Level 4
Level 4
Posts: 473
Joined: Fri Feb 02, 2018 9:56 pm
Location: Somewhere in the USA
Contact:

Re: How to refer to a Hard Drive

Post by HaveaMint » Sun Jul 15, 2018 9:35 pm

Ken Kloster wrote:
Sun Jul 15, 2018 8:51 pm
07/15/18

I have a question I can't believe nobody has ask..

I have very recently converted from Windows XP to Linux Mint. I dable in writing code in C++ and Java. When I copied all of my programs from the Windows machine to the Linux machine none of them would run because the code could not find the files I was calling for.

I am used to calling for a file by referring to the drive as A:, C:, ... . This doesn't work in Linux. I tried to use the drive name (Kloster3) and that did not work. It appears that the reference for sub-directories (/Sub-directory1/Sub-directory2/...) is the same but not for drives.

What is th secret??

Ken
cd /media/yourusername/kloster3 will get you to your drive.
"Tune for maximum Smoke and then read the Instructions".

User avatar
Flemur
Level 16
Level 16
Posts: 6276
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to refer to a Hard Drive

Post by Flemur » Sun Jul 15, 2018 9:41 pm

Ken Kloster wrote:
Sun Jul 15, 2018 8:51 pm
I am used to calling for a file by referring to the drive as A:, C:, ... . This doesn't work in Linux. I tried to use the drive name (Kloster3) and that did not work. It appears that the reference for sub-directories (/Sub-directory1/Sub-directory2/...) is the same but not for drives.
In windows A:, C:, D:, etc are either (physical) drives OR partitions on a drive.
Then you have the rest of the file path: C:\Program FIles\..\filename.exe

Open a terminal and type (well, the 'df' is nice, too)

Code: Select all

pwd
It should tell you
/home/your-username

Like D: can be a drive or a partition, /home can either be a partition, or it can be a directory; you can tell which from 'df' (ajgringo619 's is a partition because it shows partition is mounted to /home).

My /home is a directory, so df doesn't show it (tmpfs stuff omitted):

Code: Select all

$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2       30107516  4868656  23686484  18% /
/dev/sda6      164094372 45969176 109993464  30% /mnt/DATA
My two partitions /dev/sda2 and /dev/sda6 are mounted to "/" and "/mnt/DATA"; to reference them, a file path would be something like:

Code: Select all

/mnt/DATA/pictures/file.jpg
or in the other partition:

Code: Select all

/home/username/Downloads/file.jpg
That's the format for passing filenames to programs; open file.txt with text editor 'leafpad':

Code: Select all

leafpad /mnt/DATA/pictures/file.txt
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

Ken Kloster
Level 1
Level 1
Posts: 6
Joined: Fri Jul 06, 2018 8:21 pm

Re: SOLVED How to refer to a Hard Drive

Post by Ken Kloster » Sun Jul 15, 2018 9:58 pm

Thanks again for all of your help guys. I have worked with Unix based machines and it looks like a lot of Linux comes from Unix. To be fair, I have not seen a Unix based machine since Y2k.

Because of my Unix exposure and my Pre-Windows experience (MSDos, IBM Dos, ect) I am familiar with the command line and can use it. Many of the Linux functions carry the same name as the Uniix based systems. That helps.

I also figured out that like Unix, case matters and spaces in directory names can cause problems and should be avoided.

As far as Linux goes, it has been a real steep up hill battle but I am DONE with Windows PERIOD..
The machine I am currently is a dual boot system with Windows 7 as a backup. Once I get comfortable with Linux, I will convert the rest of my machines to linux.

Thanks again for your help

Ken

User avatar
all41
Level 13
Level 13
Posts: 4958
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: SOLVED How to refer to a Hard Drive

Post by all41 » Sun Jul 15, 2018 10:16 pm

Hi Ken,
Just a trailing note:
'gparted' in the repositories is an almost must-have gui partition utility.
This alone will answer many questions.

Code: Select all

apt install gparted
Proud to be a supporter and monthly contributor to Mint.

Post Reply

Return to “Newbie Questions”