Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how to access windows partitions like C or D from Linux terminal using commands because I want to work on some .cpp files there using "GCC" compiler as I don't want to change their directory to e.g. Linux desktop

I used cd /dev/sda2 but nothing happened. please help

share|improve this question

They are normally mounted on /media/USERNAME/MountName

For example, I have a windows drive which has the label "xtreme". This partition is mounted on /media/cyrex/xtreme where cyrex is my username.

If you are in the Unity Desktop you should see something like in the Unity launcher:

enter image description here

It looks like a hard drive, if you click on it, it will automatically mount the partition on /media/USERNAME. In my case, as I mentioned above, when I clicked on it, it mounted on the folder /media/USERNAME/xtreme (As mentioned before).

Now, if you want to mount that sda2 somewhere else, for example in /mnt, you can simply type in the terminal:

mount /dev/sda2 /mnt

Note that the 2 in sda2 means it is the second partition on that drive, which might mean it is the D: in your windows system (It depends on the other the hard drive was partitioned in the first place).

So if you have a C: and D: drives, assuming both are sda1 and sda2 and you want to mount them in /media/rami/ then you would:

  1. Create a folder for each (So you know which one is which)

    mkdir /media/rami/cdrive
    mkdir /media/rami/ddrive

  2. Mount each one to the already created folders

    mount /dev/sda1/ /media/rami/cdrive mount /dev/sda2/ /media/rami/ddrive

note that there are many other ways of doing it, like setting the partitions to mount automatically via /etc/fstab.

share|improve this answer
thanks very much Luis Alvarado – Rami EL-Gammal Feb 14 '13 at 10:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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