LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to Add a Hard Drive? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-a-hard-drive-376504/)

notooth 10-24-2005 05:13 PM

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?:D

DeusExLinux 10-24-2005 05:30 PM

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?

MasterC 10-24-2005 05:43 PM

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

notooth 10-24-2005 08:38 PM

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?

MasterC 10-24-2005 08:45 PM

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

DeusExLinux 10-24-2005 09:40 PM

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.

notooth 10-24-2005 11:00 PM

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.
:newbie:

btmiller 10-24-2005 11:09 PM

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.

notooth 10-24-2005 11:32 PM

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?

AwesomeMachine 10-24-2005 11:34 PM

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.

notooth 10-26-2005 02:24 AM

The hard drive is successfully mounted, and it is working now:D. 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:rolleyes:? (This might reduce the time for searching files because Linux already knows the rule where to store files.)

I look forward to your response.:D

Dtsazza 10-26-2005 09:14 AM

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.

MasterC 10-26-2005 04:16 PM

Quote:

Originally posted by notooth
The hard drive is successfully mounted, and it is working now:D. 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:rolleyes:? (This might reduce the time for searching files because Linux already knows the rule where to store files.)

I look forward to your response.:D

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


All times are GMT -5. The time now is 07:15 AM.