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

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, October 29, 2008

Follow me on Twitter as @mattiasgeniar

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



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.