LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How to add a hard drive existing Linux system (http://www.linuxquestions.org/questions/linux-hardware-18/how-to-add-a-hard-drive-existing-linux-system-337748/)

a1ntsk33r3d 06-27-2005 03:25 PM

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

schneidz 06-27-2005 04:00 PM

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

a1ntsk33r3d 06-27-2005 07:00 PM

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.

DaWallace 06-27-2005 07:18 PM

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)

a1ntsk33r3d 06-27-2005 07:26 PM

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!

schneidz 06-28-2005 02:20 PM

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


All times are GMT -5. The time now is 03:25 PM.