Common Configuration Commands
Creating a Physical Volume
After you scan for LUNs on a host, the LUNs are identified as drive letters like hdisk#. The following uses hdisk2 as an example. Perform the following steps to create a physical volume:
- Run the chdev command to create a physical volume.
bash-3.2#chdev -l hdisk2 -a pv=yes
- Run the lspv command to verify the physical volume creation.
bash-3.2#lspv hdisk0 00c690001d571eda rootvg active hdisk1 00c6900012ddf6f6 None hdisk2 00c6900034ddf6f6 None hdisk3 None None
If a physical volume is created successfully, a physical volume identifier is added to corresponding disks. In the output, the physical volume identifier is 00c6900034ddf6f6.
Creating a Volume Group
Perform the following steps to create a volume group:
- Run the smitty mkvg command to create a volume group.
bash-3.2#smitty mkvg
On the screen that is displayed, choose Add a Big Volume Group to go to the screen for configuring volume groups, as shown in Figure 9-1.
Configure the following volume group parameters:
- VOLUME GROUP name
Name of a volume group. This parameter is user-configurable.
- PHYSICAL VOLUME names
Press Ctrl+4 to select the physical volumes that you want to add to the volume group, for example, hdisk2 and hdisk3.
- Volume Group MAJOR NUMBER
Maximum number of a volume group. This parameter is optional, and is used only in importing volume groups on other nodes.
Keep the default values of the other parameters and press Enter. The volume group is created.
- VOLUME GROUP name
- Run the lsvg command to check volume group information.
bash-3.2# lsvg vg_hacmp VOLUME GROUP: vg_hacmp VG IDENTIFIER: 00072ea20000d40000000135834ed376 VG STATE: active PP SIZE: 128 megabyte(s) VG PERMISSION: read/write TOTAL PPs: 1598 (204544 megabytes) MAX LVs: 256 FREE PPs: 17 (138752 megabytes) LVs: 3 USED PPs: 1581 (1024 megabytes) OPEN LVs: 3 QUORUM: 2 (Enabled) TOTAL PVs: 2 VG DESCRIPTORS: 3 STALE PVs: 0 STALE PPs: 0 ACTIVE PVs: 2 AUTO ON: yes MAX PPs per VG: 32512 MAX PPs per PV: 1016 MAX PVs: 32 LTG size (Dynamic): 1024 kilobyte(s) AUTO SYNC: no HOT SPARE: no BB POLICY: relocatable PV RESTRICTION: none
In the output, pay special attention to PP SIZE, which will be used in determining the logical volume size during logical volume creation.
Creating a Logical Volume
Perform the following steps to create a logical volume:
- Run the smit mklv command to create a logical volume.
bash-3.2# smitty mklv
On the screen that is displayed, press Esc+4. The names of all volume groups are displayed. Choose the name of a volume group for which you want to create a logical volume and press Enter. The screen for configuring logical volume properties is displayed, as shown in Figure 9-2.
Configure the following logical volume parameters:
- Logical volume NAME
Name of a logical volume. This parameter is user-configurable.
- Number of LOGICAL PARTITIONS
Number of logical partitions. Determine the parameter value based on the previously obtained PP SIZE.
- PHYSICAL VOLUME names
Physical volume to which a logical volume belongs.
- Logical volume TYPE
File system type (JFS/JFS2).
Keep the default values of the other parameters and press Enter. The logical volume is created.
- Logical volume NAME
- Run the lslv command to confirm that the information about the newly created logical volume is correct.
Creating a File System
Perform the following steps to create a file system:
- Run the smit crfs command to create a file system.
On the screen that is displayed, choose a file system type. Available file system types are as follows:
- Add an Enhanced Journaled File System
Corresponds to JFS2.
- Add a Journaled File System
Corresponds to JFS.
- Add a CDROM File System
Corresponds to an ISO file system in CDROM format.
The following explains how to create a JFS2 file system.
- Add an Enhanced Journaled File System
- If logical volumes have been created, choose Add an Enhanced Journaled File System on a Previously Defined Logical Volume. The screen for configuring file systems is displayed, as shown in Figure 9-3.
Configure the following parameters:
- LOGICAL VOLUME name
Name of a logical volume
- MOUNT POINT
Mount point. This parameter must be different from that of an existing volume.
- Mount AUTOMATICALLY at system restart?
Whether to automatically mount the file system upon system startup.
Keep the default values of other parameters.
- LOGICAL VOLUME name
- If no logical volumes are created, choose Add an Enhanced Journaled File System. Choose a volume group to go to the screen for configuring file systems, as shown in Figure 9-4.
Configure the following parameters:
- Unit Size
Size of a unit. The unit size and number of units determine the size of a volume.
- Number of units
Number of units.
- MOUNT POINT
Mount point.
- Mount AUTOMATICALLY at system restart?
Whether to automatically mount the file system upon system startup.
Keep the default values of other parameters.
- Unit Size
- Run the lslv command to confirm that the information about logical volumes is correct.
- Run the mount command to mount logical volumes. The command syntax is as follows:
mount /dev/logical volume name
Activating a Volume Group
Activate a volume group after importing it. Only an activated volume group can be mounted for data access. Run the following command to activate a volume group:
varyonvg volume group name
Deactivating a Volume Group
Deactivate a volume group before exporting it. Run the following command to deactivate a volume group:
varyonvg volume group name
Exporting a Volume Group
In clusters, a volume group needs to be imported or exported during data backup and recovery. Run the following command to export a volume group:
exportvg volume group name
The following is an example:
bash-3.2# lspv
hdisk3 00c6900028b4ccaa vgB
hdisk4 none None
hdisk5 none None
hdisk6 00072e72c5a7d7d4 vgB
bash-3.2# exportvg vgB
bash-3.2#lspv
hdisk3 00c6900028b4ccaa None
hdisk4 none None
hdisk5 none None
hdisk6 00072e72c5a7d7d4 None
Importing a Volume Group
Run the following command to import a volume group:
importvg volume group name physical volume name
The following is an example:
bash-3.2# lspv
hdisk3 00c6900028b4ccaa None
hdisk4 none None
hdisk5 none None
hdisk6 00072e72c5a7d7d4 None
bash-3.2# importvg -y vgB hdisk3
bash-3.2# lspv
hdisk3 00c6900028b4ccaa vgB
hdisk4 none None
hdisk5 none None
hdisk6 00072e72c5a7d7d4 vgB
Deleting a Logical Volume
Perform the following steps to delete a logical volume:
- Run the umount command to unmount the logical volume.
- Run the rmlv command to delete the logical volume.
Deleting a Volume Group
Perform the following steps to delete a volume group:
- Ensure that all logical volumes contained in the volume group are deleted.
- Deactivate the volume group.
- Run the rmvg command to delete the volume group.
Deleting a Physical Volume
Run the following command to delete a physical volume:
chdev -l hdisk# -a pv=clear
The following is an example:
bash-3.00# lspv
hdisk0 none None
hdisk1 00c69f2242c89068 rootvg active
hdisk2 none None
hdisk3 00c69f228c77ae1a None
hdisk4 00c69f228c88fd65 None
hdisk5 none None
bash-3.00# chdev -l hdisk3 -a pv=clear
hdisk3 changed
bash-3.00# lspv
hdisk0 none None
hdisk1 00c69f2242c89068 rootvg active
hdisk2 none None
hdisk3 none None
hdisk4 00c69f228c88fd65 None
hdisk5 none None
bash-3.00#