LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 06-01-2006, 07:11 AM   #1
hykhoshn
LQ Newbie
 
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
how do I mount an external USB hard drive


I am VERY new to linux. any hint is appreciated.
When I plug in an external USB hard drive in one of
the FRONT USB ports (both REAR ports used already used):

1- how do I make the system recognize it?
2- how do I mount this drive and what type of
filesystem is it.

SYS: Dell Poweredge 2800 running Red Hat Enterprise
Linus ES 3.
 
Old 06-01-2006, 10:14 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
You can usually use "auto" as the filesystem type, so when you mount the drive the filesystem gets automatically detected (normally). If it does not get automatically mounted when you plug the cable in, then add the information about it into your /etc/fstab file; for this you'll need to know two things: 1) where you want it to be mounted (in which directory will you want to see it's contents) and 2) what is the device file (a special file in /dev directory) called. The 2nd question is most of the time the "harder" one, but you could try guessing: for usb hard drives it's usually (but not always) sda1, sda2, sda3, or something like it (second usb hard drive would be sdb1, sdb2, ..., in a normal situation).

First when you plug the cable in, open up a console and do

Code:
dmesg
and when it gets to the bottom, read the last 10 or so lines, for information if your drive was seen (you should see text that tells the name of the drive, some usb info etc., and some device name, like sda or sdb - this is the part we need). Now let's say you read the lines from dmesg and it said something about "sda" there. Let's also say you want the drive to be mounted in /mnt/usbdrive (change this to what you really want).

First, create the mount directory where the drive will show it's contents:

Code:
mkdir /mnt/usbdrive
second, get superuser rights if you're not logged in as root:

Code:
su
when asked for password, type in the root password (it won't show you any letters or *s or small circles or anything, so don't wait to see any while typing) and hit enter. Then, open up a text editor of your choise and /etc/fstab in it (gedit, nano, vim, joe, emacs, kwrite, what ever you like - launch it from the command line so it's opened with super user rights):

Code:
gedit /etc/fstab
go to the bottom and write a line like this:

Quote:
/dev/sda1 /mnt/usbdrive auto rw,users,auto,umask=0222 0 0
where sda1 is the device file (you might have to change it), /mnt/usbdrive is the mount place you created, first "auto" tells fstab you want it to detect the filesystem, the comma-separated list is a list of options (read-write, users can unmount it too, it gets automatically mounted at bootup, everyone can access it not just root), and the last two zeroes..well, you can read more about them issuing man fstab, just write them now.

After you've saved, simply try:

Code:
mount /mnt/usbdrive
and if you get no output, you're fine. Next bootup your drive is there automatically every time. BUT if you did get output, a line that tells you sda1 is not found or something, then something's wrong. Most of the time the problem is that the device file is wrong (this is why you read dmesg output to figure it out). Then open up /etc/fstab file again, change sda1 to sda2 or sda4 or whatever you think it should be. dmesg output is of great help finding this out.

Once you get this done, you don't have to worry about it again, it's there. Nowadays people have nice things like automounters so they don't have to do this even, but adding new drives to fstab is always a sure way.

EDIT: about the dev filenames. sda is normally assigned to an usb or scsi device, and the number (sda1, sda2, sda3 etc.) depends on the device, most of the time it's 1 for the first device, 2 for the second etc. Also, when dealing with harddisks, first disk should get sda, second sdb and so on. Like hda for a primary "normal" harddisk, hdb for a secondary "normal" harddisk etc. The two names I've seen most often are sda1 and sda4 (I can't tell why it's just sda4 and not sda2, for example, but that's what my devices have always been, or at least almost always - so sda1 and sda4 are good tries if you start guessing).

Last edited by b0uncer; 06-01-2006 at 10:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount points on usb devices (dig. camera, zip drive, external hard disk) Impaler Linux - Hardware 3 05-29-2006 11:08 PM
New to RH9 please help me to mount? a external usb hard drive ginda Linux - Newbie 7 05-29-2006 07:11 PM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM
How to mount external USB hard drive? zyzyis Linux - Newbie 6 02-01-2006 09:37 PM
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 08:48 AM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration