LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-27-2005, 04:25 PM   #1
a1ntsk33r3d
LQ Newbie
 
Registered: Mar 2004
Location: NC
Distribution: RHEL3 (WS), Update 3
Posts: 16

Rep: Reputation: 0
Question How to add a hard drive existing Linux system


Friends, I have an existing Red Hat 9.0 (2.4.20-8) system running that I have added RAM and a CD-ROM drive to with no problems.

I've now added an additional 40GB hard drive to the system, and I would like to add it logically so my partitions have more space available. I have no idea how to do this! I have the drive physically connected, and the system sees it as /dev/hdb.

Currently, my system shows:

Code:
---------------------------------------------------------------------------

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              27G  2.6G   23G  11% /
/dev/hda1              99M   14M   80M  15% /boot
none                  314M     0  314M   0% /dev/shm

---------------------------------------------------------------------------

# cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hda3               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

---------------------------------------------------------------------------

# fdisk -l

Disk /dev/hda: 30.0 GB, 30020272128 bytes
255 heads, 63 sectors/track, 3649 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        13    104391   83  Linux
/dev/hda2            14      3552  28427017+  83  Linux
/dev/hda3          3553      3649    779152+  82  Linux swap

Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1             1      4865  39078081   83  Linux

---------------------------------------------------------------------------
So, I have successfully added the disk and deleted the NTFS partition table using fdisk. What do I do now???
 
Old 06-27-2005, 05:00 PM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,213

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
it didn't come up in your df -h list because it is not listed in your fstab. fdisk lists it. so to mount it you can do a:

mount -t ext2 /dev/hdb1 /mnt/hd2

forgive me, i didn't test it out. you may not need to specify the type (-t ext2) or it may just be wrong. (man mount for acceptable arguements).

when you get it working on the command line, add it your fstab to automagically mount it on start-up.

~schneidz
 
Old 06-27-2005, 08:00 PM   #3
a1ntsk33r3d
LQ Newbie
 
Registered: Mar 2004
Location: NC
Distribution: RHEL3 (WS), Update 3
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks for the help; still having trouble

Thanks for the tip -- what you stated makes perfect sense. I'm not sure if I'm doing something wrong or not, but when I run the command below as root (where <mount point> is various things like /var2, /temp2, etc. on the filesystem):

Code:
# mount -t ext2 /dev/hda3 <mount point>
I get an error that says
Code:
mount: mount point <mount point> does not exist
. Does this mean that the place I'm mounting the disk must exist first? I've tried touching a file (for example, /var2) but that doesn't seem to work either.
 
Old 06-27-2005, 08:18 PM   #4
DaWallace
Member
 
Registered: Feb 2004
Location: Southern Maine, United States
Distribution: Slackware Ubuntu Debian FreeBSD
Posts: 418

Rep: Reputation: 31
it has to be a directory.

and it doesn't seem that you've formatted a filesystem on it yet, if you haven't then you'll run into that error after you fix the mount-point problem.

use mkfs to do so. (mkfs.ext2 or mkfs.ext3, as you may prefer)
 
Old 06-27-2005, 08:26 PM   #5
a1ntsk33r3d
LQ Newbie
 
Registered: Mar 2004
Location: NC
Distribution: RHEL3 (WS), Update 3
Posts: 16

Original Poster
Rep: Reputation: 0
DaWallace, that was the ticket! I used mkfs to format the disk first, as in:

Code:
mkfs.ext3 /dev/hdb
Then, I created a new directory to use as the mount point:

Code:
mkdir /var2
Next, I mounted the newly formatted partition (which happened to be the whole hdb device, in my case):

Code:
mount /dev/hdb /var2
I simply wrote out these steps in case it might help somebody else that comes along. I have one final question; what entries should I place in /etc/fstab to ensure that my new directory gets mounted each boot time? I'm a little confused about that.

My current /etc/fstab includes:

Code:
# cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hda3               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0
Thanks!
 
Old 06-28-2005, 03:20 PM   #6
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,213

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
there is a man-page for fstab so you can get info on all feilds there. (make sure it's not the fstab.h man-page)

i don't think you can go wrong by copying/ modifying the line for the root partition. in that case it would be:

# source destination file-system parameters dump fsck-order
/hdb1 /var2 ext3 defaults 1 1

good luck
 
  


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
how to add a hard drive to a linux system? kike_coello Linux - Hardware 13 10-18-2005 11:35 PM
Add a Hard Drive to Linux AndeAnderson Linux - Hardware 7 02-24-2005 03:06 PM
How to install a new hard drive on to existing system ksgill Linux - Newbie 3 02-07-2005 01:17 AM
Add a new hard drive to existing RH 7.2 guanyu Linux - Software 1 02-27-2002 11:17 PM
adding new hard drive to existing linux box jaysan Linux - Newbie 2 08-09-2001 07:27 PM


All times are GMT -5. The time now is 05: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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration