How can I access hard disk partitions via command line in Linux Mint?

Abhinav March 13, 2011
Pinterest Stumbleupon Whatsapp

I am using Linux Mint. I have four hard disk partitions. I want to know how I can access these drives by command line as we do in DOS prompt. Whenever I try with cd command, it shows an error message. It only changes the directories within home directory.

Ads by Google

  1. Anonymous
    March 15, 2011 at 8:00 am
  2. Mike
    March 14, 2011 at 12:21 am

    First you will want to know which partitions are already mounted and where. The following command will give you all that information.
    $ sudo mount

    If the desired partition is shown and mounted you can cd~ into it's mount directory, for example
    $ cd /mnt/partition2

    If it is not currently mounted you will have to do that. First you will want to know the device identifier for the partition.
    $ sudo fdisk -l

    it is a lowercase L... The identifier will look something like
    /dev/sda2

    Now you have to create a mount point, the path is pretty much up to you.
    $ sudo mkdir /mnt/mypartition

    Since you probably want it to be mounted all the time we'll skip the mount comman and go right into the fstab
    $ sudo nano /etc/fstab
    You can replace nano with any other text editor - but I think nano is the best for beginner users.

    Within the fstab you have to add a line which tells Linux to mount the partition. There should already be some entries which will give you a general guideline about how the line has to look like. Some examples:

    mounting a FAT32 partition
    /dev/sda2 /mnt/mypartition vfat umask=000,defaults 0 0

    mounting a NTFS partition
    /dev/sda2 /mnt/mypartition ntfs umask=000,defaults 0 0

    To quit nano simply press ctrl + x. It will then ask you if you want to save the changes, press Y, and if you want to save it into the same fstab file, press Enter

    The last step will be to make the changes take effect
    $ sudo mount -a