From: drake@drake.almaden.ibm.com (Sam Drake)
Newsgroups: comp.unix.aix
Subject: Re: How Do You Partition A Disk In AIX?
Date: 9 Apr 92 06:21:02 GMT
Organization: IBM Almaden Research Center

In article <1412@newave.UUCP> john@newave.mn.org (John A. Weeks III) writes:
>I just obtained an RS/6000 with two 400 M-Byte disks.  
>The second disk does not appear to be set up in any way.  I 
>cannot figure out how to make partitions on this disk, or
>how to tell if there are any existing partitions on it that
>are not mounted.  

AIX doesn't use "partitions"; rather, AIX uses "logical volumes".
A "logical volume" is very similar to a partition, if not essentially
identical, but with extra functionality...specifically, a logical
volume can span multiple physical volumes, does not have to occupy
physically contiguous space on a volume, and can be extended at any
time while the system continues to operate (want to make /u bigger,
OK, type a command ... *poof* ... it's bigger).  It can also be 
transparently mirrored onto 2 or more physical disks for reliability.

Here's the taxonomy.

Physical volumes (what we humans call "disk drives") are each assigned to
a volume group.  The default system comes with one volume group called
"rootvg".  By default, only your 1st drive will be a member of rootvg.
All the space on all the physical volumes of a volume group is treated
as a single pool of space, with no regard for physical volume boundaries.

Logical volumes (what you could think of as partitions) are sub-allocated
from a volume group, not from a particular physical volume.  The contents
of a logical volume may be formatted as a UNIX file system (or might not be).

>                  I also cannot find a `partitions' file in
>the etc directory.  

Since the structure is much more flexible, and different, there is no
"partitions" file.

>                    I was able to tell that the device is
>configured as hdisk1 using smit (and that the disk with root
>is hdisk0).

Um, well, not quite.  Hdisk0 and hdisk1 are the names of the physical 
volumes in your system.  By default, hdisk0 is a member of volume group
rootvg, and your root logical volume, "hd4", resides in rootvg.  In fact,
all of your logical volumes reside in rootvg.  

>I have set up disks a number of times with SVR3 and a zillion
>times on SunOS--but AIX does not seem to be like either of
>these two UNIX systems.

Yes, it has a LOT more functionality in this area than those systems.
(a benefit) But it's administered differently. (a cost for administrators
who know the old ways, another benefit for those who do not)

>Can someone give me some pointers or point me to a place in a
>manual?  Smit seemed to be no help--it has a bunch of stuff on
>logical volume groups, which seem to assume that you have the
>partitions already made.

No, the logical volume manager is where you want to go.  

First, you have to decide if you want to put both volumes into
a single volume group (rootvg), or if you want the 2nd volume
in a separate group.  If it's in a separate group, you can't have
a filesystem that spans volumes.  If you want a separate group,
think up a name for it.  Unless you need a >400MB filesystem, I'd make
both disks separate volume groups.

Then, run "smit"; select "physical and logical storage", and select 
"define a fixed disk to the operating system".  You then select either
"add a fixed disk to an existing group" or "add a fixed disk without data
to a new group", as appropriate.  Fill in the prompts and press enter.
Now your 2nd drive is in a volume group.

Now pop back up to "physical and logical storage", and select "file 
systems".  Select "Add/change/show/delete filesystems".  Select
"journalled filesystems" (unless you want to add NFS or CD-ROM
filesystems).  Then select either add, change/show, or remove.
Answer the questions, and press enter.  That's it.  If you're
adding a new filesystem, one question will be which volume group
the filesystem is to reside in.  Note that you can use "change/show" 
to make a filesystem larger at any time, without rebooting.  Magic!
The "installp" process uses this, for example, to make the filesystems
the "right" size for the installed software automatically when AIX
is loaded...not larger.

To see how much space is available in a volume group, or what resides
on which physical volume, go spelunking in "logical volume manager"
under "physical and logical storage".  

If you don't want to use smit for this, you don't have to ... each
of these operations is a command.  For example, "lsvg -l rootvg" will
tell you about all the logical volumes in the rootvg volume group.
At any menu, press F6 in SMIT and it'll show you the command it
would execute to do what you've entered.  You don't have to edit any 
files by hand to do anything, ever...and should not do so.

>BTW, if I do manage to make partitions on the second disk, how
>do I get them to be mounted automatically on bootup?  Is this
>just an entry in the `filesystems' file, or does it have to be
>coded in somewhere else?

When you create a filesystem as described above, one of the questions on
the menu is, "Mount AUTOMATICALLY at system restart?" ... just answer
YES.

>I assume that I have to do some mkdev's, then mkfs, then mount,
>but I cannot find docs on the proper device names for mkdev,
>or the number of sectors for mkfs.

As described above, those assumptions are incorrect.  I hope you'll agree
that the function and flexibility provided by the AIX mechanisms are
worth learning something a bit new.


Sam Drake / IBM Almaden Research Center 
Internet:  drake@almaden.ibm.com    BITNET:  DRAKE at ALMADEN
Newsgroups: comp.unix.aix