LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-31-2004, 10:16 PM   #1
Tiyogi
Member
 
Registered: Nov 2003
Location: Hyde Park, Ny
Distribution: Ubunta
Posts: 117

Rep: Reputation: 15
need a little help using fdisk and formating


Ok, heres the deal. I have a 20gig hard drive that I want to divide up into 5 pieces.
I have the following so far.

[root@linpen2 root]# fdisk -l

Disk /dev/hdc: 255 heads, 63 sectors, 2434 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 637 5116671 83 Linux
/dev/hdc2 1224 2434 9727357+ 83 Linux
/dev/hdc3 638 1147 4096575 83 Linux
/dev/hdc4 1148 1223 610470 82 Linux swap

Partition table entries are not in disk order

Disk /dev/hda: 255 heads, 63 sectors, 784 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 784 6297448+ c Win95 FAT32 (LBA)

=========================================================


If I read the fdisk correctly I now have
  • /dev/hdc1=5 gig
  • /dev/hdc2= 10gig
  • /dev/hdc3= 5 gig
  • /dev/hdc4= 500mb swap

This what I want
  • /dev/hdc1=5 gig
  • /dev/hdc2= 5gig
  • /dev/hdc3= 5 gig
  • /dev/hdc4= 500mb swap
  • /dev/hdc5= 5 gig

Can I just delete the /dev/hdc2 and create 2 new partitions out of the space?

Also /dev/hdc is a linux only disk what filesystem should I use? Should I chose linux or linux extended?

Once I have created these partitions do I need to format them?
Would I use mkfs.ext3 or something different?
 
Old 05-31-2004, 10:37 PM   #2
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,513

Rep: Reputation: 46
Hi friend!

Can I just delete the /dev/hdc2 and create 2 new partitions out of the space?

No, you can't. You see, a harddisk can have up to four primary partitions in it. If you need more than four, you should create an extended one, to contain logical partitions inside.

If you wanna have five partitions, you should create three primary and one extended. The extended partition will exist only to contain logical ones inside, so it doesn't eat up space per se. The logical one will.
It follows that you disk layout will be:
hdc1 primary
hdc2 primary
hdc3 primary swap
hdc4 primary extended
hdc5 logical
hdc6 logical

hdc4 will be "invisible" to the system, I mean, it won't have to be mounted and stuff. You'll see only hdc1,2, and 5.

(Also notice that both swap and extended are kinds of primary partitions).

So, to answer your question: if you wanna prepare this disk to install red hat on it, you'd better delete hdc2,3 and 4. And re-edit the layout with diskdruid which is a very easy and nice partition software, if you choose manual partitioning.

To get this:
# /dev/hdc1=5 gig
# /dev/hdc2= 5gig
# /dev/hdc3= 5 gig
# /dev/hdc4= 500mb swap
# /dev/hdc5= 5 gig

Suppose you are starting with the disk completely blank, you'll have to:

1. Create # /dev/hdc1=5 gig as a primary.
2. Create # /dev/hdc2= 5gig as a primary.
3. (hdc3 will have to be the swap, as a swap can't be logical) Create # /dev/hdc3= 500mb swap as a primary swap.
4. Create # /dev/hdc4 as an extended, with ~9,5GB (20-the above used)
5. Create the logical one /dev/hdc5 inside the extended, with 5GB
6. Create another logical /dev/hdc6 with ~4,5GB

The broken numbers account for the 500mb used as a swap.

Post again if you need more help!

Last edited by bruno buys; 05-31-2004 at 10:46 PM.
 
Old 05-31-2004, 10:40 PM   #3
Phorem
Member
 
Registered: Nov 2003
Location: Toronto, Canada
Distribution: Gentoo AMD64
Posts: 374

Rep: Reputation: 30
Well, i don't know if you have information on the hard drive that you don't want destroyed but i would fire up fdisk and delete the first partion. This will remove ALL of the partions. When you list the partions using "p" in fdisk, you shouldn't see anything. Then i would start with a boot partion (where grub/lilo and your kernel will reside). For example :

linux@root#> fdisk /dev/hda (or hdc in your case)

fdisk > p (list)
fdisk > n (new partion) make it " 1 " and a primary partion
it will ask how big you want it - use a format like this instead of using blocks " +32M " . That uses megabytes. So +5000M is 5gig's.

Then start with the rest of the partions. When you are done, make /dev/hda1 the active "boot" partion (if you are using Gentoo or Slack). Use the " a " option in fdisk to select the boot partion.

Sometimes i like to get rid of the MBR before i start using fdisk (just so i know, it's all clean). Basically for your information:

dd if=/dev/zero of=/dev/hda bs=512 count=1

When you are all finished and you have selected " w " in fdisk, you can format the partions.

ext2 = mke2fs (mke2fs /dev/hda1 for example)
ext3 = mke2fs -j
reiserfs = mkreiserfs

Don't forget about the Swap :
mkswap /dev/hda2 (for example)

enable Swap
swapon /dev/hda2 (example again)
 
Old 06-01-2004, 09:18 PM   #4
Tiyogi
Member
 
Registered: Nov 2003
Location: Hyde Park, Ny
Distribution: Ubunta
Posts: 117

Original Poster
Rep: Reputation: 15
Well it looks like I screwed up something.
My grub will not load now. "Grub read error"

/etc/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd1,0)
# kernel /boot/vmlinuz-version ro root=/dev/hdc1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd1,0)/boot/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-14)
root (hd1,0)
kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ #hdd=ide-scsi
initrd /boot/initrd-2.4.18-14.img
title DOS
rootnoverify (hd0,0)
chainloader +1


I have a floppy boot disk tha allowed me to get into linux.
The syslinux.cfg from the floppy

from floppy syslinux.cfg

default linux
prompt 1
display boot.msg
timeout 100
label linux
kernel vmlinuz
append initrd=initrd.img hdd=ide-scsi root=/dev/hdc1

My linux is located on hdc1. Is grub trying to read it off hdd??

Where is the problem is it in the grub or the mbr?
Do I need to change grub?
Do I fdisk mbr?
 
Old 06-03-2004, 10:51 AM   #5
Phorem
Member
 
Registered: Nov 2003
Location: Toronto, Canada
Distribution: Gentoo AMD64
Posts: 374

Rep: Reputation: 30
Well, did you remove your MBR with the dd if=/dev/hd........... command?
If so, it's gone. If you can't get the MBR to work again, then you have to boot up with your floppy and chroot.

1. make sure you have a folder in /mnt/ that you can mount your hard drive to when you boot up from the floppy. For example /mnt/hd or whatever you like. Or just use /mnt/cdrom if you have to. The name is irrelevant.

2. Boot up with the floppy and at the command prompt.....

root#> mount /dev/hdc3 /mnt/hd (the hdc3 is an example - it should be where your root directory resides)
root#> mount /dev/hdc1 /mnt/hd/boot (hd should contain your root partion with the boot directory - where grub and the kernel are)
root#> mount -t proc none /mnt/hd/proc

After that, we should be good to go. Next....

root#>chroot /mnt/hd /bin/bash

You should now be in your old root directory and able to use the commands you had before.

Try.....

root#>grub

Set up grub and install it to the MBR this way. After grub is installed and set up again and the kernel is in the /boot directory you have to exit and umount the partitions.

root#>exit (takes us back to the floppy command prompt - leaving chroot)
root#>umount /mnt/hd/boot /mnt/hd/proc /mnt/hd
root#>reboot

Hope it helped a bit :-)
 
  


Reply



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
weird fdisk problem (Fdisk unable to see winxp partitions) khidot Slackware - Installation 5 04-07-2007 09:26 PM
Formating Eugney Linux - Newbie 2 05-02-2005 03:50 AM
formating mfds Linux - Software 7 04-14-2004 11:15 AM
formating Galilee Linux - Software 2 09-30-2003 11:23 PM
formating.... s9722 Linux - Hardware 10 06-17-2003 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 AM.

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