Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.