dibaliklayar

Wednesday, January 11, 2006

Adding Drive to Fedora Takes more effort than SuSe

From: http://forums.teamphoenixrising.net/archive/index.php/t-32150.html

Just doing this now, so I might as well write it up.

In my case I have a 400Gb disk to add as secondary master. I want this to mount at boot as /share2 and I'll only have one partition on the disk.

So.....

Step 1: Hardware installation

Shutdown the machine.
Add the disk as normal (in hardware terms)
Update BIOS and make sure the machine sees the disk.
Reboot the machine.

The first thing you'll notice is that Fedora does not prompt you that a new disk has been added. Kudzu, the tool which checks for hardware changes, ignores HDDs. So we'll have to do it manually. Trust me, it doesn't take long.

Open a shell and su to root.

Step 2: Create the partition on the disk

Type in the command as follows. Replace my device name /dev/hdc with yours as appropriate. Linux labels IDE hard drives as follows:

Primary master = /dev/hda
Primary slave = /dev/hdb
Secondary master = /dev/hdc
Secondary slave = /dev/hdd

if you use SCSI drive the name of your drive is like /dev/sda or /dev/sdb

So in my case the drive is /dev/hdc and so the command is:

fdisk /dev/hdc


if you are installing a large disk you will receive warnings - ignore them.

You are now within fdisk so to create a partition type in

n (new partition)
p (primary partition)
1 (partition number 1)
(take default start cylinder in my case 1)
(take default end cylinder in my case 48641)
w (rewrite partition table to the disk)

the last command will also exit fdisk

Step 3: Format the partition

OK I have my partition but it is not formatted. The command to do this in my case is

mkfs.ext3 -L /share2 /dev/hdc1

mkfs.ext3 actually creates the partition.
-L /share2 is the label of the partition, I normally label mine to match the mount point, keeps things cleaner.
/dev/hdc1 - notice the change? Not using /dev/hdc any more. That's because I'm formatting a partition, not a disk. /dev/hdc1 is, logically, the first partition on the secondary master drive /dev/hdc. Simple :)

This command will just run, give you a few facts and figures, then exit. Congrats! We're formatted!

Step 4: Create a mount point and change the system to mount automatically

Linux partitions are mounted on directories, so we need to create the directory entry before we can mount. In my case I want to mount this new drive on /share2, so the command is:

mkdir /share2

That's the mount point taken care of.
Now I want to make sure the machine mounts the partition at reboot, so I need to edit the file systems table, /etc/fstab. I use vi, if you have a preferred text editor use it.

I added a line to /etc/fstab as follows:

LABEL=/share2 /share2 ext3 defaults 1 2

Translation:

LABEL=/share2 - filesystem labelled /share2 - see step 3 - now perhaps you see why I label to match mount points
/share2 - mount on directory /share2
ext3 - the filesystem type
defaults - use default permission handling
1 2 - "1" =- available to the Linux dump command ( a backup utility), "2" - fsck behaviour, normally a value of "1" is used for boot filesystems and "2" for all others.

That's it! Reboot and enjoy all those extra bytes :)

0 Comments:

Post a Comment

<< Home