Skip to content

How To Mount A USB Hard Disk Through Command Line (Linux)

Here's how to mount a USB hard disk drive (ie; external storage) on a Linux server, through the command line.

First, attach the hard disk and turn it on. Then look in /var/log/messages for a message similar to the ones shown in bold. This will tell you the device-location of your recently attached hdd.

server#: tail -f /var/log/messages -n 25

-- MARK --
kernel: usb 4-1: new high speed USB device using ...
kernel: usb 4-1: configuration #1 chosen from 1 choice
kernel: scsi9 : SCSI emulation for USB Mass Storage devices
kernel: SCSI device sde: 586072368 512-byte hdwr sectors (xx MB)
kernel: sde: Write Protect is off
kernel: SCSI device sde: 586072368 512-byte hdwr sectors (xx MB)
kernel: sde: Write Protect is off
kernel:  sde: sde1
kernel: sd 9:0:0:0: Attached scsi disk sde
-- MARK --

The external storage can be found in /dev/sde1, as shown in the message-log (the last lines).

Make a new directory, and mount the device to that point.

# mkdir /mnt/usb-storage
# mount /dev/sde1 /mnt/usb-storage

And now you can navigate to /mnt/usb-storage and find your content of the external storage

Comment Feed

16 Responses

  1. Hi

    thanks for the help you offer.
    I am trying to mount an external storage device.
    The result of the mount command
    [..... mnt]# mount /dev/sdb/ /mnt/backup/
    mount: “please specify filestyem type” (my traslantion).

    What should I do?
    Thanks
    mario
    [root@mario mnt]#

  2. @Mario; you can specifiy the filesystem using the “-t” parameter.
    Should become something like: mount -t ntfs /dev/sdb /mnt/backup
    Replace “ntfs” with the filesystem you have.

    Mount will usually “auto guess” the filesystem, and mount it accordingly. If it’s an external drive previously mounted in Windows, there’s a chance it will state a “corrupt filesystem”. Best to attach it to a Windows desktop first, and choose the “Safely remove hardware” functionality to remove to external drive.

  3. thx a lot
    that worked for a usb disk that doesn’t automatically mount on my ubuntu server.

    I get a blank message box on xfce when trying to access the drive trought the desktop icon.

  4. Dude you are truly elite! Thanks honorable guru, you helped me out of a major jam :D

  5. thank you, that was very helpful. All the circles of forum hell gaily instruct us to
    mount /dev/sda1
    for the new USB drive, without giving any inkling of how to come up with the /dev/sda1 mount point. in particular, mine already had a device there, so I knew that could not be the right one..

  6. The article is quite helpful but it is not a solution for my problem, my question is as folows

    I have an external hard drive at /dev/sdda1
    it has 2 folders
    /abc/data1
    /abc/data2
    All I need is to mount these 2 folders on my machine as

    /data1
    /data2
    but the question is how to?
    Quick response is requested.

    Regards.

    • Are you sure about the “/dev/sdda1″ partition? It looks odd, but I’ll continue this example as such.

      You dan to it as follows to mount your disk.
      mkdir /mnt/usbdisk
      mount /dev/sdda1 /mnt/usbdisk

      then symlink to your locations
      ln -s /mnt/usbdisk/data1 /data1
      ln -s /mnt/usbdisk/data2 /data2

  7. Thanx moti,
    the idea sems god
    i have issued following command on console
    ln -s /sdda1/cis2bu/gad/ /gad

    it is mapped but the problem is
    when I issue ls -lrt in /gad folder
    instead of showing the contents of /sdda1/cis2bu/gad i.e. folder1. folder2 and folder 3
    it shows me gad
    meas I have to issue
    cd /gad/gad to chk the contents
    where as I need onl to issue cd /gad and ls comand to chk all the contents

  8. Name correction
    Matti
    sorry for spell error

  9. Thank you Matti for your help
    it is done

  10. thanks for the heads up on the log messages, that helps…

    However my log messages does not specify a location for my external hard drive. It says:

    kernel: sd 9:0:0:0: [sdb] Write Protect is off
    kernel: sd 9:0:0:0: [sdb] Mod Sense:00 00 00 00
    kernel: sd 9:0:0:0: [sdb] Assuming drive cache:write through
    kernel: sdb:
    kernel: sd 9:0:0:0: [sdb] Attached SCSI disk

    can u recommend anything??

    regards!

  11. Hi,

    Thanks a lot for your valuable suggestion.

    It just craved me out of vain for mounting a USB in an Ubuntu Server machine.

    – Harsh –

  12. Thanks for valuable info here.

    If I installed Ubuntu using external HD as primary, and now need to transplant the HD to a headless server (no VGA/keyboard/etc), is there a change to a file that I can make to ensure that on next reboot (in the headless server) that the HD mounts as the primary drive (not external)?

    Any insight would be appreciated!



Some HTML is OK

*

or, reply to this post via trackback.