General discussion


Add a Hard Drive

By AndeAnderson ·
I have Debian installed with a SCSI HDD as the Boot Drive.

I want to add a second HDD. The second HDD is a Western Digitial 20 GB IDE Drive. Debian sees it as it boots up but I can't find out how to prepare it to be used with Debian.

What are the steps for adding a second HDD in Linux?


This conversation is currently closed to new comments.

12 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Jaqui In reply to Add a Hard Drive

1) run fdisk to create the partition structure on hda
2) assign mount point(s)
3) edit fstab to mount at boot if wanted.

or, if already existing partion,
run mount to mount it.
define the mount point first naturally.

existing partiton is most likely fat32 or ntfs

Collapse -

by AndeAnderson In reply to

When I try to fdisk the hda, fdisk /dev/hda, I receive the following message "cdrom: open failed"

Why is it trying to fdisk my cdrom?

I am new to Linux and you lost me after fdisk. The Help file tells me no help topics match either "fdisk" or "mount."

Wouldn't Linux format the new partition? When I use fdisk then all FAT or NTFS partitions would be deleted and I would have to repartition and reformat the hard drive for whichever file system I wanted to use. At least that is what it does with the fdisk that I have beeen using for the last 15 years.

I asked here because the documentation I found only talks about Hard Drives during the installation. The other documentation I found only talks about unmounting and remounting.

Thanks for trying.

Collapse -

by Jaqui In reply to Add a Hard Drive

swap the channels to the cdrom and hard drive.
seems you have the cdrom in channel0 and hard drive in 1
( primary = 0 secondary =1 )

that is why fdisk is going after the cdrom.

or, type fdisk hdc

no, this will not autmatically remove partitions.
try typing fdisk --help to get full fdisk options in usage.
yes the -- is needed if you use the help.
single - with just h will do same thing, display the help screen.

moount is the system tool to be able to access hard drives, cdroms, dvdroms, or floppy drives.
if there is a disk in and you don't mount the device, then it won't be accessable.

maybe it's been named umount or umount2 ( I've seen both used )
you have to explicitly tell linux fdisk to do something, same as with microsoft's version.

Collapse -

by AndeAnderson In reply to

Sorry, this answer would only make sense to someone who already knew Linux and how to use it.

Collapse -

by EarleZO In reply to Add a Hard Drive

linux refers to devices according to the way they are installed. Primary Master is /dev/hda, Primary Slave is /dev/hdb and Secondary MAster is /dev/hdc. Secondary IDE channel slave is referred to as /dev/hdd

A cd rom can be known as either /dev/cdrom or the drive place in the connection schema above.

You use the command fdisk to partition the drive. "cfdisk" is more user fiorendly if installed. Alternatively, you can use a commercial tool such as Partition Magic. There are many others but cfdisk is quite easy. ALso look at bootitng to manage partitions. Do NOT install it - use it in maintenance mode.

Once you have created a partition, you need to create a "mount point" on your directory tree.

Assume you wish to use this drive to replace your existing /home directory to store user files.

I will assume for example that the drive is /dev/hdc.

Back up your existing /home and test it.
After partitioning, use the mke2fs command to format the drive. If it is /dev/hdc1 the command is mke2fs /dev/hdc1

Then you can copy the existing /home to the partition using the command
dd if=/home of=/dev/hdc1

Verify that the copy was successful

Use the mv command to rename /home as /oldhome
Create a new directory /home
Issue the command mount /dev/hdc1 /home

Run the command mtab and you will see the line that refers to /home and /dev/hdc1

Copy that line to the file /etc/fstab

IF all is well, you can after a prudent amount of time, delete the /oldhome directory freeing up the space.

I hope that has been helpful

Collapse -

by AndeAnderson In reply to

Sorry, but if I knew what a mount point was it might help. And why would I want to move the home directory?

Collapse -

by jdclyde In reply to Add a Hard Drive

In my experience, THIS WILL NOT WORK.

I tried to do something like this not long ago and found the if you put an IDE drive in your system, the system will try to boot to that INSTEAD of the SCSI drive.

There was not an option in the BIOS to select the SCSI drive before the IDE.

I had a three SCSI drives, and wanted to throw one big IDE drive in for a quick ADDITIONAL backup. We have some users that pooch files quite often, and would have been much quicker to retrieve from an internal hard drive than to search the tape backups. This was going to be in addition to the tape. Didn't work so.

Collapse -

by AndeAnderson In reply to

Sounds like what I'm trying to do. I have a Boot SCSI Hard Drive, my BIOS allows this and can see the IDE Drive, but I can't get Linux to accept or use the IDE HDD.

Collapse -

by stress junkie In reply to Add a Hard Drive

I've read the previous answers. If I didn't know the answer already those answers wouldn't help much. I looked around the Internet to see if there was a good procedure. I couldn't find one. Maybe this will help.

First you have to understand how the disks are named in Linux. The master disk on the first IDE controller is /dev/hda. The slave disk on the first IDE controller is /dev/hdb. The first SCSI disk is /dev/sda. The second SCSI controller is /dev/sdb. And so on.

When you originally installed Linux you should have had the CDROM as the master on the first IDE controller. That would make it /dev/hda. If you do $ls -l /dev/cdrom it probably points to /dev/hda. Now you want to install another IDE disk. You should install it as the master on the second IDE controller. That will probably make it accessible through /dev/hdb or /dev/hdc.

Once you have the cables and jumpers on the new disk set up then boot Linux. There are numerous utilities to show you what hardware is in your system but we'll use trial and error because it is simple and fast.

Log in as root. Start a terminal window such as xterm or gnome-terminal. Check to see if there is a program called /sbin/cfdisk. If that exists then run it. If /sbin/cfdisk doesn't exist then run /sbin/fdisk. Either way you want to pass one of the disk paths to the program as follows:

# /sbin/cfdisk /dev/hda

If you passed the path to the CDROM the program will fail saying that it cannot access the disk. In that case try another device path. If no device paths work then Linux cannot 'see' your new disk. Check the master/slave jumper. Check the data cable connector to see if it is inverted.

Once you have the right device path then cfdisk or fdisk will show you their opening screens. cfdisk is graphical. fdisk is like MS-DOS FDISK. It is command line. Press m and press enter to get a list of commands.

That should get you started. It seems that I've used up my 2000 character limit. I will add a comment for mo

Collapse -

by stress junkie In reply to

So now you have one or more partitions on your new disk. Each partition is addressed by succeeding integers as 1, 2, 3, and 4. Now you have to create a file system on the partition(s). I recommend the basic ext2 file system. Once you get more experience you can always play with the other file system types. In the following command we'll use the default values for most of the configurable options. We will assume that the new IDE disk is /dev/hdb. As root enter the following command:

/sbin/mke2fs -n -v -T news /dev/hdb1

This will test run the command. It will not actually do anything. If you get no errors then run the command without the -n as follows:

/sbin/mke2fs -v -T news /dev/hdb1

When that is finished you have to create an empty directory in the existing file system. This will be the access point for the file system on the new disk. You need a mount point for each partition. You could create a mount point as a subdirectory to the existing /mnt directory. Let's do that. Enter the following command:

mkdir /mnt/newdisk

Now you can mount the disk to that empty mount point as follows:

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

Now enter the following command:


This should show that /mnt/newdisk has a file system mounted.

Now enter the following commands

cd /etc
cp fstab fstab.original
chmod u+w fstab
pico fstab

This will get you into a text editor, pico, which is very easy to use. Add the following line to the bottom of the file:

/dev/hdb1 /mnt/newdisk ext2 defaults 1 1

Save the file. Then enter the following commands:

umount /mnt/newdisk

You should be able to see that the /dev/hdb1 disk/partition is no longer mounted. Now enter:

mount -a

You should be able to see that /dev/hdb1 is once again mounted on /mnt/newdisk. The system will automatically mount this when you restart Linux.

Back to Linux Forum
12 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums