3

Well I am a newbie in Linux world. Everyday learning by working. I use dual booting and in one drive Windows 7 is installed and in another drive Ubuntu 14.04 LTS is installed. My first O/S was windows 7. There was few drives like Workshop, Movies, Soft etc. Now I was about to change drives in terminal to access files stored in different drives. After spending couple of hours I discovered a way to access different files in different drives. What I did is first of all I mounted lets say /dev/sda2 drive in /media/username folder using this command....

$ sudo mount /dev/sda2/ media/username

Once mounted then I can easily change directories by using cd command.

Now my questions are...

  1. Is this really a correct way to change drives to access files?
  2. I can go forward like $cd /media/username but how to go backward? I mean go back to root or go back to media? In windows CMD I am using cd.. to go one folder back. Is there any similar command for terminal?
  3. What is the difference between drive and partition?
  4. How to unmount a drive or any file?
  5. My last question is as far as I know in Linux files are arranged under root / directory. If so then it might don't respect windows drive systems. If so then all files should be accessed without mounting any drive to /media/username folder?
1
  • This question seems a bit broad.
    – trysis
    Apr 28, 2015 at 19:28

1 Answer 1

12

First, note there is a typo in mount your command. It should be:

$ sudo mount /dev/sda2 /media/username

Here /dev/sda2 is the device (in this case, a hard drive's partition) you want to access, and /media/username is your mountpoint, i.e., the location in the filesystem where you want to mount the device.

To answer your questions:

  1. Yes, using cd is the normal way to change directories. And mount is perfectly fine to mount devices that are not already mounted. If you mount it often, you may want to make an entry in /etc/fstab so that in the future you can mount a particular device to a particular mountpoint with self-defined options, e.g., by simply writing mount /media/username. You may even want to consider mounting it automatically, at boot time. There is a lot of excellent documentation on the subject. Just search for fstab.

  2. I guess you want to do a bit of reading about the Linux filesystem. There's also good documentation for this, see, e.g., here for a short overview. / is the root folder in which everything is contained, organized in various subfolders. Here's a few hints concerning cd:

    • cd (without arguments) will get you to your home folder, typically /home/username
    • cd - will get you to the previous folder (where you were before you changed to the current folder)
    • cd .. will get you to the parent folder (one level up). This is equivalent to cd.. in Windows CMD.
    • cd / will get you to the root folder, though I personally rarely need that.
  3. A (hard) drive is actually a disk that you can store data on. It is usually divided into several partitions. Perhaps confusingly, in the Windows world these partitions are also called drives. This is not the case in the Linux world, though. We simply call them partitions, or perhaps "devices" in a technical context.

  4. To unmount a mounted device, use the command sudo umount <MOUNTPOINT>, e.g., in your example,

    sudo umount /media/username
    

    ...where /media/username is a mounted partition (you could also use sudo umount /dev/sda2, though this is perhaps less intuitive). Simply write mount (without arguments) to see a list of all currently mounted devices with their mountpoints.

  5. In Linux, you have to mount each of your Windows "drives" on a separate mountpoint. You are completely free to choose where, and you already know how to do it, as you showed with your mount command. :)

3
  • 2
    Maybe you want to add that manually mounted drives usually go into /mnt/somemountpoint and /media/user/somemountpoint is used for automounting USB, CD, etc.
    – s3lph
    Apr 28, 2015 at 15:19
  • 2
    The command "man hier" should supply Mike with some interesting information about the filesystem tree Apr 28, 2015 at 16:38
  • 1
    @MalteSkoruppa Thanks for such an explanatory answer. You spent significant amount of time for helping me. Many thanks man. :) Apr 29, 2015 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .