Need (want) a second Physical Disk Drive (
George Toft
plug-discuss@lists.plug.phoenix.az.us
Tue, 07 Jan 2003 02:25:15 -0500
George Gambill wrote:
>
> 1.) How do I partition a Brand New (Raw) disk. I have used fdisk on windows
> machines but not Linux.
>
> Lets say it is a 30 Gig drive and I want to partition it into:
>
> 1ea 25 gig ext3 partition for directory "/Clients"
> and
> 1ea 5 gig ext3 (approx) partition for "/XYZ" (To Be Determined).
>
> What are the command line commands or would this be easier from the GUI. I
> prefer learning the command line stuff.
As root: fdisk
or: cfdisk
> Looking at the output from the "df" command, I find:
>
> Filesystem Mounted on
> /dev/hda5 /
> /dev/hda1 /boot
> /dev/hda3 /home
> none /dev/shm
> /dev/hda2 /usr
> /dev/hda7 /var
>
> Question, what happened to /dev/hda4
hda1..4 are primary partitions. hda5..??? are logical partitions, all
of which must exist inside one of the primary partitions marked as an
extended partition. If you run fdisk and press P (print partition
table), you will get a better picture of what is going on. Here is an
example from my box:
Disk /dev/hda: 255 heads, 63 sectors, 14593 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 14593 117218241 5 Extended
/dev/hda5 1 2 16002 83 Linux
/dev/hda6 3 133 1052226 82 Linux swap
/dev/hda7 134 1439 10490413+ 83 Linux
/dev/hda8 1440 14593 105659473+ 83 Linux
and /etc/fstab (edited for clarity):
/dev/hda5 /boot ext2 defaults 1 2
/dev/hda6 swap swap pri=42 0 0
/dev/hda7 /var ext3 defaults 1 2
/dev/hda8 / ext2 defaults 1 1
In this case, partition 1 holds part 5-8. This is what SuSE chose for
me. Fine.
Here's one I did for myself:
Disk /dev/hdb: 16 heads, 63 sectors, 77622 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 61 30712+ 83 Linux
/dev/hdb2 62 1102 524664 82 Linux swap
/dev/hdb3 1103 49406 24345216 5 Extended
/dev/hdb4 49407 77622 14220864 83 Linux
/dev/hdb5 1103 3180 1047280+ 83 Linux
/dev/hdb6 3183 47880 22527760+ 8e Linux LVM
/dev/hdb7 47881 49406 769072+ 83 Linux
Here, part 3 holds part 5-7. My way is restrictive. SuSE's is much
more flexible as you can have only 4 primary partitions, but a whole
bunch of logical partitions in the extended partition.
> Question, what is none ... /dev/shm
shared memory, or something like that.
> Assuming I need entries in fstab. what would they be.
That depends on how many partitions you set up. I've swung both ways,
from one huge part to many smaller ones. I'm still a fan of many
partitions, but not lots of them. There are strong points for putting
/home and /usr/local on their own partitions. I did this when I first
started out, and I tried many Linux distros while keeping my home
directory and my locally installed stuff intact from distro to distro.
No, this wasn't planned - I got lucky.
As far as command line versus a gui tool (or a command line pretty tool
like cfdisk), I recommend using a tool. It will help you visualize your
drive and make sure each partition is mounted somewhere. Now that I
have been in Computer Security for a while, I am a strong proponent of
tools over command line heroics. I've seen too many changes
fat-fingered by Unix Admins from editing with vi - some resulting in a
box that would not boot properly. Stupidest practice I was ever
involved in.
George