LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-27-2003, 09:59 PM   #1
vicvac
LQ Newbie
 
Registered: Oct 2003
Posts: 1

Rep: Reputation: 0
How to add a hard drive


Hi,

I was looking to a quick and easy how to for installing a new second hard drive. After searching your archives I didn't really find a really quick and easy how to.

Below is a quick and easy example, I figured that adding a drive must be a question that gets asked a lot so I thought I would share this.

As root perform the following: (as highlighted in bold)

[root]# fdisk /dev/hdb
Command (m for help): m (Enter the letter "m" to get list of commands)
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2654, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2654, default 2654):
Using default value 2654

Command (m for help): p

Disk /dev/hdb: 240 heads, 63 sectors, 2654 cylinders
Units = cylinders of 15120 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 2654 20064208+ 5 Extended

Command (m for help): w (Write and save partition table)

[root]# mkfs -t ext3 /dev/hdb1
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2508352 inodes, 5016052 blocks
250802 blocks (5.00%) reserved for the super user
First data block=0
154 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root]# mkdir /opt2
[root]# mount -t ext3 /dev/hdb1 /opt2





--------------------------------------------------------------------------------
File: /etc/fstab

Enter the drive into the fstab file so that it is recognized and mounted upon system boot.

File: /etc/fstab Red Hat 8.0

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/hda2 swap swap defaults 0 0
/dev/hdb1 /opt2 ext3 defaults 1 2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0



The digits "1 2" refer to whether the mount point should be backed up when the dump command is used and disk integrity checks using fsck. The "1" states that it should be backed up when the dump command is issued (0=no). The "2" refers to the order in which "fsck" should check the mount points. The digit "1" identifies the root ("/") of the filesystem. All others should be "2". (0=no check)
 
Old 10-28-2003, 08:33 AM   #2
Phathead
Member
 
Registered: Sep 2003
Distribution: Slackware 10.1, Slamd64 10.1, IpCop 1.4
Posts: 125

Rep: Reputation: 15
Couple notes to help people who may be new at this:

cfdisk is much more user friendly than fdisk

/dev/hdb may not be the location of the new drive you installed. Please don't blindly use that device. If you don't know the location of your new drive, get help before running fdisk or cfdisk.
 
Old 10-28-2003, 09:48 AM   #3
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
More notes: There are other variations but, basically, a-b-c-d are primary master-primary slave-secondary master-secondary slave and IDEs are hd and SCSIs are sd. If you've got something else, you probably know it.

And cfdisk actually has strange cursor operations to me. fdisk is just as friendly - it just has a letter-based text menu instead of a button-based tui menu. But to each their own.

And there are other mkfs options if you want reiser and so on.
 
Old 11-25-2003, 02:21 AM   #4
fernin8r
LQ Newbie
 
Registered: Jan 2003
Posts: 27

Rep: Reputation: 15
Confused newbie

first ... i'm using RH9 i am adding a Mator 17G hard drive that previously had a billion partitions (thanks Win95) . i successfully removed all old partition, created one new partition and formated that partition. I am also able to mount the device on startup using /etc/fstab to a folder called /opt2,

My question is now (forgive me i'm a newbie) how do i know what is being saved to the added hard drive and what is being saved to the original?
 
Old 11-25-2003, 09:34 AM   #5
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Based on your description, if you save something to /opt2, it's written to the new one and, otherwise, it's written to the old. It depends on your partitions, mount points, and where you save stuff.
 
Old 11-25-2003, 07:04 PM   #6
fernin8r
LQ Newbie
 
Registered: Jan 2003
Posts: 27

Rep: Reputation: 15
The added hard drive only has one partition hdb1
i added the following line to /etc/fstab file for mounting:

/dev/hdb1 /opt2 ext3 defaults 1 2

so, just to make sure will everything i save to /opt2 will be saved on the hdb1 partition?
 
Old 11-25-2003, 07:16 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 23,918

Rep: Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268Reputation: 5268
Yes.
 
Old 11-25-2003, 07:19 PM   #8
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Yep.
 
Old 03-18-2004, 10:51 AM   #9
xfiles_wolvie
Member
 
Registered: Mar 2004
Location: Singapore
Distribution: RH 9.0
Posts: 34

Rep: Reputation: 15
Hi, I have a problem mounting a hard disk. it my win xp hdd.

when i key in /etc/fstab, they give me permission denied and I M login s the root. i try chmod bt cant quiter fig it out..can any1 gve me the detail steps to do or key in the command line in my terminal? my win xp hdd is 20G wif 2 partition of 1st 10G 2nd 9G nmy Linux RH9 is on my 2nd hdd.

i can get to c fdisk n all my drives info bt i cant get to mount that winxp hdd. can any1 helpme?
 
Old 03-18-2004, 03:17 PM   #10
scuba
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Rep: Reputation: 0
Unhappy FireWire Drive help

Maybe this should go into a new thread, but these are my two cents...

First, I'm using Fecora Core 1. Installed on a Compaq Aramada 500 (a laptop) that has a PCMCIA FireWire controller connected to an external 80GB HD.

Fedora wasn't able to use the drive. I don't know why. I've searched a bit, and found that by issuing rescan-scsi-bus.sh (that I got from here
I can get linux to use it (after this command it appears in /proc/scsi/scsi, and can be mounted).

And finally, to My question :
How do I make that happen AUTOMATICALLY, at every boot?

And while we're at it ,
Is there a way to move most (if not all) of the harddrive to the new drive?
I'd like to leave /boot and maybe /etc on the old drive (it's a 4GB HD) and have the entire / (except these two) moved to the new HD.
Is that at all possible???

Any help will be appreciated!
Thanks.
 
  


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? notooth Linux - Newbie 12 10-26-2005 05:16 PM
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
add hard drive mnauta Linux - Hardware 1 01-09-2004 05:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 10:01 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
Open Source Consulting | Domain Registration