As stated above, all disk management tasks performed by SAM
can also be done using HP-UX commands.
The following tables give you general information on the commands
you will need to use to perform a given task. Refer to the HP-UX
Reference for detailed information.
Table 3-2 Commands Needed for Physical Volume Management Tasks
Task | Commands Needed |
|---|
Changing the characteristics of a physical
volume in a volume group. | pvchange(1M) |
Creating a physical volume for use in
a volume group. | pvcreate(1M) |
Displaying information about physical
volumes in a volume group. | pvdisplay(1M) |
Moving data from one physical volume
to another. | pvmove(1M) |
Table 3-3 Commands Needed for Volume
Group Management Tasks
Task | Commands Needed |
|---|
Creating a volume group. | vgcreate(1M)
[1] [2] |
Removing volume group. | vgremove(1M)
[3] |
Activating, deactivating, or changing
the characteristics of a volume group. | vgchange(1M) |
Backing up volume group configuration
information. | vgcfgbackup
(1M) [4] |
Restoring volume group configuration
from a configuration file. | vgcfgrestore(1M) |
Displaying information about volume group. | vgdisplay(1M) |
Exporting a volume group and its associated
logical volumes. | vgexport(1M) |
Importing a volume group onto the system;
also adds an existing volume group back into /etc/lvmtab. | vgimport(1M)
[5] |
Scan all physical volumes looking for
logical volumes and volume groups; allows for recovery of the LVM
configuration file, /etc/lvmtab. | vgscan(1M) |
Adding disk to volume group. | vgextend(1M)
[6] |
Removing disk from volume group. | vgreduce(1M) |
Table 3-4 Commands Needed for Logical Volume Management Tasks
Task | Commands Needed |
|---|
Creating a logical volume. | lvcreate(1M) |
Modifying a logical volume. | lvchange(1M) |
Displaying information about logical
volumes. | lvdisplay(1M) |
Increasing the size of logical volume
by allocating disk space. | lvextend(1M) |
Decreasing the size of a logical volume. | lvreduce(1M)
[1] |
Removing the allocation of disk space
for one or more logical volumes within a volume group. | lvremove(1M) |
Preparing a logical volume to be a root,
primary swap, or dump volume. | lvlnboot(1M)
[2] |
Removing link that makes a logical volume
a root, primary swap, or dump volume. | lvrmboot(1M) |
Increasing the size of a file system
up to the capacity of logical volume. | extendfs(1M)
[3] |
Splitting a mirrored logical volume into
two logical volumes. | lvsplit(1M)
[4] |
Merging two logical volumes into one
logical volume. | lvmerge(1M)[5] |
Example: Creating a Logical Volume Using HP-UX Commands
To create a logical volume:
Select one or more disks. ioscan(1M)
shows the disks attached to the system and their device file names.
Initialize each disk as an LVM disk by using the
pvcreate command.
For example, enter
pvcreate /dev/rdsk/c0t0d0 |
Note that using pvcreate
will result in the loss of any existing data currently on the physical
volume.
You use the character device file for
the disk.
Once a disk is initialized, it is called a physical volume.
Pool the physical volumes into a volume group. To
complete this step:
Create a directory for the volume group. For example:
Create a device file named group
in the above directory with the mknod
command.
mknod /dev/vgnn/group c 64 0xNN0000 |
The c following
the device file name specifies that group
is a character device file.
The 64
is the major number for the group
device file; it will always be 64.
The 0xNN0000
is the minor number for the group
file in hexadecimal. Note that each particular NN
must be a unique number across all volume groups.
For more information on mknod,
see mknod(1M); for more information on major
numbers and minor numbers, see Configuring HP-UX for
Peripherals.
Create the volume group specifying each physical
volume to be included using vgcreate.
For example:
vgcreate /dev/vgnn /dev/dsk/c0t0d0 |
Use
the block device file to include each disk
in your volume group. You can assign all the physical volumes to
the volume group with one command. No physical volume can already
be part of an existing volume group.
Once you have created a volume group, you can now
create a logical volume using lvcreate.
For example:
Using the above command creates the logical volume /dev/vgnn/lvoln
with LVM automatically assigning the n
in lvoln.
When LVM creates the logical volume, it creates the block
and character device files and places them in the directory /dev/vgnn.