Ubuntu: Mount The Drive From Command Line

I‘m new to Ubuntu Linux. How do I mount the hard disk drive from command line?

You need to use the mount command. # Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to mount /dev/sdb1 at /media/newhd/. You need to create a mount point using the mkdir command. This will be the location from which you will access the /dev/sdb1 drive.
$ sudo mkdir /media/newhd
To mount the drive, enter:
$ sudo mount /dev/sdb1 /media/newhd
$ df -H

To view files cd to /media/newhd, enter:
$ cd /media/newhd
$ ls -l

A Note About Automatic Mount At Boot Time

You need to edit /etc/fstab file, enter:
$ sudo vi /etc/fstab
Add the following line for ext3 file system:

/dev/sdb1    /media/newhd   ext3    defaults     0        2

Add the following line for Windows FAT32 file system:

/dev/sdb1    /media/windowshd   vfat    defaults     0        2

Save and close the file.

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Juan Pablo Jul 7, 2013 @ 22:23

    Gracias, me sacaron de una gran duda en momentos en que estaba solo con la consola.

    Juan Pablo

  • INFLICTED Aug 27, 2013 @ 16:02

    I had some complications with the editing of the fstab folder. It would try to mount my partition witch is on an internal drive. I would get the message like “unable to load media/Downloads press ‘S’ to skip or ‘W’ to wait. I was reading the forums and Juan Pablo inspired an idea. This is what I have done to auto mount any of my drives at start-up.

    Step1: Click on Settings/Start-up Applications

    Step 2: Enter whatever you like for Name/Comment

    Step 3: Under the command option we will be using the udisks utillity behind the scenes just as Nautilus does in the GUI environment. Use this command:

    /usr/bin/udisks --mount /dev/sdb1

    (IMOPRTANT) Where I have /dev/sdb1 you will need to replace sdb1 with your correct partition. To find this you can use the Disk Utillty program from the Dashboard)

    It is odd that I’ve not run accross this method anywhere else online. That is why I have posted here. Thank you Juan for your inspiration!

  • Alberto Aug 10, 2015 @ 16:27

    Very helpful and simple.


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum