LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2005, 06:13 PM   #1
notooth
Member
 
Registered: Apr 2005
Posts: 73

Rep: Reputation: 15
Question How to Add a Hard Drive?


I just added a hard drive to my computer running Redhat Enterprise Linux 4, but I do not know where it is in the file system. Can anyone tell me how to config the new hard drive with the GUI?
 
Old 10-24-2005, 06:30 PM   #2
DeusExLinux
Member
 
Registered: May 2004
Location: Tampa, Fl
Distribution: Arch
Posts: 648

Rep: Reputation: 30
The easiest way is to add it in the /etc/fstab ... you can specifiy where you want the drive to be mounted, and the options you want..

Check out the man fstab page for more details. If you have problems, check back and maybe I can help you understand the jargon..

You do have to find out where the /dev/ is located... is it an external drive or an internal ide/sata drive?
 
Old 10-24-2005, 06:43 PM   #3
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
Well, actually if it's a new hard drive, they've got to a bit more than just that.

They've got to give it partitions, and a filesystem.

I believe in Redhat EL you have a How-To that actually gives good detail... Ah yes:
https://www.redhat.com/docs/manuals/...STORAGE-ADDREM

Cool
 
Old 10-24-2005, 09:38 PM   #4
notooth
Member
 
Registered: Apr 2005
Posts: 73

Original Poster
Rep: Reputation: 15
I do not know what type of file system I should set to the partitions, and how to use the mkfs command. Is there a GUI for all of these?
 
Old 10-24-2005, 09:45 PM   #5
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
The type should be whatever type of filesystem you'll be using. If unsure, go with ext3. This is type 83. And the mkfs command, depending on the new partition number:
mke2fs -j /dev/hda3
Replace /dev/hda3 with whatever you created with fdisk.

Cool
 
Old 10-24-2005, 10:40 PM   #6
DeusExLinux
Member
 
Registered: May 2004
Location: Tampa, Fl
Distribution: Arch
Posts: 648

Rep: Reputation: 30
And there is a gui for hard-drive partitioning... qtparted is a pretty good one... but good old fdisk and mkfs are just as easy.
 
Old 10-25-2005, 12:00 AM   #7
notooth
Member
 
Registered: Apr 2005
Posts: 73

Original Poster
Rep: Reputation: 15
I updated the fstab and rebooted the machine, but I did not see the new folders mounted. Here is the fstab content:

Code:
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

/dev/sdb1		/var/www/html/dsb21/usermedia/pictures	ext3	defaults	1 1
/dev/sdb2		/primary2		ext3	defaults	1 1
/dev/sdb5		/var/www/html/dsb21/usermedia/pictures	ext3	defaults	1 1
/dev/sdb6		/local6			ext3	defaults	1 1
/dev/sdb4		/primary4		ext3	defaults	1 1
/dev/hdc                /media/cdrom            auto    pamconsole,ro,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
Hope someone can help.
 
Old 10-25-2005, 12:09 AM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Check your dmesg and /var/log/messages logs to see if there are any errors. In particular, did the mount points exist before you tried to mount them? The mount points, e.g. /local6 must exist on your filesystem.
 
Old 10-25-2005, 12:32 AM   #9
notooth
Member
 
Registered: Apr 2005
Posts: 73

Original Poster
Rep: Reputation: 15
There are some lines in dmesg:
Code:
mounted file system with ordered data mode
Does it mean the new hard drive has successfully been mounted?
How do I know if files are written on the new hard drive or the existing mount point?
 
Old 10-25-2005, 12:34 AM   #10
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 3,278

Rep: Reputation: 587Reputation: 587Reputation: 587Reputation: 587Reputation: 587Reputation: 587
Let me start at the beginning. Linux has a directory tree off root ("/") which contains directories, files, devices, and a few other things. You have to make mount points, which are regular old directories (e.g. "mkdir /mnt/mynewdrive"). All these mount points must be put in the root directory, which is the root partition of your linux installation. So, when you launch a file manager, it shows you the root ("/") directory tree. Every other thing which stores data on the whole PC is a directory off the root directory tree. That means you have a mount point there for any new thing you install.

You don't need to mount a drive to partition and format it. In fact, if there are no partitions on it, there is nothing to mount. Disk partitioning programs show partitions if they are there, but if the drive is unpartitioned the program will still find it. You should be able to find the disk partitioner in your linux distro somewhere. Most partitioning software also formats the partitions. fdisk is a noteable exception. When you partition a drive, each partition needs a mount point, that exists in the root tree. So, use the mkdir command to make your mount points. I usually put them in /mnt, but you can put them off / if you wish.

here is a sample fstab line for a HDD partition:

/dev/sdb<space>/mnt/local<space>ext3<space>defaults<space>0<space>2

Do not have 2 partitions that have the same last number. Root should have 1.

Once you have the disk formatted, and in your distro I would use ext3, when you boot the next time it should automatically go in fstab.

I know you can do it. Don't ever give up. I have faith in you.
 
Old 10-26-2005, 03:24 AM   #11
notooth
Member
 
Registered: Apr 2005
Posts: 73

Original Poster
Rep: Reputation: 15
The hard drive is successfully mounted, and it is working now. I would like to thank all of you who have ever helped me out.

There is one more thing I have been concerned. The hard drive I just mounted is going to store files uploaded from my website. The number of files might approach millions (I hope,) and the drive capability might not fullfil the need. Therefore, I will have to add a new hard drive and wonder how to do this. These are some questions I would like to consult:

1. How to mount multiple hard drives to 1 mount point?
2. What type of file system is the best for storing and searching a numerious of small files?
3. Is there a way to set a rule and make Linux automatically sort (by file name) and store files in appropriate sub-folders when files are uploaded? (This might reduce the time for searching files because Linux already knows the rule where to store files.)

I look forward to your response.

Last edited by notooth; 10-26-2005 at 03:26 AM.
 
Old 10-26-2005, 10:14 AM   #12
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
1. According to the mount man page,
Quote:
Since Linux 2.4... multiple mounts can be stacked on the same mount point.
I'm at work right now so I can't check this out for myself, but it should be as simple as mounting partition A at {yourmountpoint}, then mounting partition B at that same point. In /etc/fstab, you'd be able to mount partitions where you wanted without worrying whether anything else was there. This does raise the question, though - what happens if both partitions have folders with the same name? If someone wants to try this and enlighten me before I get a chance to try it out myself (I can think of three possible outcomes), I'd be grateful.

2. Reiser FS is good for that sort of thing, due to its being backed by a balanced tree. And in my (admittedly non-scientific) findings, most people who've used it seem happy with it. One word of warning though, there seems to be a much larger overhead than ext2/3 - so if you're using small drives you might find it actually gets slower.

3. This would be an application-specific question - Linux stores a file in the specific directory and with the specific filename that it's told to. If you wanted to apply some kind of filtering on uploaded files, you'd have to do it in the application that accepts (or possibly sends) those files. Basically, wherever the filename is chosen, that's where you need to filter. If you're asking solely in terms of making searches faster, then that's something that could be done with a shell script (e.g. if you're searching for a jpeg, search these directories first, then run through the rest). However, I don't think there's much of an advantage you'd get over just using common sense (e.g. if you're looking for a picture, look in /home/foo/pictures first) and I certainly wouldn't recommend any automatic filtering scheme that's too complex for you to keep in your head anyway.
 
Old 10-26-2005, 05:16 PM   #13
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
Quote:
Originally posted by notooth
The hard drive is successfully mounted, and it is working now. I would like to thank all of you who have ever helped me out.

There is one more thing I have been concerned. The hard drive I just mounted is going to store files uploaded from my website. The number of files might approach millions (I hope,) and the drive capability might not fullfil the need. Therefore, I will have to add a new hard drive and wonder how to do this. These are some questions I would like to consult:

1. How to mount multiple hard drives to 1 mount point?
2. What type of file system is the best for storing and searching a numerious of small files?
3. Is there a way to set a rule and make Linux automatically sort (by file name) and store files in appropriate sub-folders when files are uploaded? (This might reduce the time for searching files because Linux already knows the rule where to store files.)

I look forward to your response.
1. Use LVM or Raid, I prefer LVM simply because I understand it better You (without using LVM) cannot simply mount up multiple devices to a single mount point to 'add space' to that directory. LVM is one way, you can add a new hard drive and copy the old data, but adding an additional drive, I'd use LVM with XFS (xfs_grow is very easy and doesn't screw with your files when growing a filesystem). It's been the easiest way I've found.

2. Indeed, ReiserFS, as noted above.

3. You could probably script this if you have any scripting knowledge. However, you may be able to accomplish this with a series of cron-jobs; a combo of a nice script a cron-job would be ideal IMHO. Check out the Bash-How-To at http://tldp.org to see how easy it actually may be to make the scripting you are looking for.

HTH

Cool
 
  


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
Want to add Hard Drive in SuSE 9.1 akshay1476 SUSE / openSUSE 1 06-10-2005 04:05 AM
Add a Hard Drive to Linux AndeAnderson Linux - Hardware 7 02-24-2005 03:06 PM
Add hard drive Wardy Linux - Newbie 3 01-19-2005 06:34 PM
How to add a hard drive vicvac Linux - Hardware 9 03-18-2004 03:17 PM
add hard drive mnauta Linux - Hardware 1 01-09-2004 05:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration