Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand AIX disk Management

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to understand AIX disk management, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Add a hard disk to the system

Method 1, this method is applicable to the situation where the system is restarted before configuration, when the system is restarted, cfgmgr is automatically called, and the newly added disk is automatically configured.

Use lspv to view the configured disks in the system

# lspv

Hdisk0 00092204880d7036 rootvg

Hdisk1 none none

In the display, hdisk1 is a new hard disk and no pvid is allocated. You can configure hdisk as a physical volume with the following command:

# chdev-l hdisk1-a pv=yes

This command assigns a unique pvid to disk hidsk1 and writes pvid in the boot record of that disk. If the disk already has pvid, the disk is configured as a physical volume.

Method 2, which is suitable for situations where the system cannot be restarted before configuration

1. Use lspv to check the current physical volumes.

# lspv

2, and then call cfgmgr to check for new devices in the system and configure new devices

# cfgmgr-v

3. Call lspv to check to see if there is a disk that does not allocate pvid

4. If there is a disk with no pvid assigned, configure it with chdev.

# chdev-l hdisk2-a pv=yes

Method 3, the method is suitable for the disk that cannot be restarted before configuration and cannot be detected by cfgmgr. This method requires the user to know the specific information of the hard disk. Know the type of the hard disk (Type), the subtype of the connection of the hard disk (Subclass), the parent setting name of the hard disk connection (Parent Name) and the logical location of the hard disk (Location Code)

Use mkdev to configure the disk in the following format:

# mkdev-c disk-s Subclass-t Type-p ParentName-w Location Code-a pv=yes

Example: add a 679m hard disk and connect it to the scsi3 parent device. Its scsi id is 6 and its logical unit number is 0.

# mkdev-c disk-s scsi-t 670mb-p scsi3-w 6 pv=yes 0-a pv=yes

Or call smit mkdev to configure

2. The command chpv for modifying disk properties

Chpv [- h Hotspare] [- an Allocation] [- v Avaliability] [- c] Pvname

The-a parameter is to set the allocation permissions for physical volumes. When allocation is y, new PP is allowed, while n is not allowed to assign PP.

For example: # chpv-a n hdisk1

The-v parameter sets whether the physical volume is available. When Avaliability is r, it sets the physical volume to be unavailable. When a, it sets the physical volume to be available.

For example: # chpv-v r hdisk1 (setting physical volumes not available)

# chpv-v a hdisk1 (set physical volumes available)

The-c parameter is to clear the boot record of the physical volume (boot record)

For example: # chpv-c hdisk1

The-h parameter sets the hot backup characteristics of physical volumes

Third, display information about physical volumes

1, displaying all configured or defined physical volumes in the system

# lsdev-Cc disk

2, displaying the properties of the physical volume

# lspv hdisk0

3, displaying the logical volumes allocated on the physical volume

# lspv-l hdisk0

4, showing the distribution of physical partitions on the physical volume

# lspv-p hdisk0

4, showing the correspondence between physical and logical partitions

# lspv-M hdisk0

The output of the command has two columns in the following format:

Pvname: pp-pp lvname: lp:copy

Delete physical volumes

"because a physical volume is a device, to delete a physical volume, you must first change the physical volume from an available state to a defined state, with the following command:"

# rmdev-l hdisk5

Since the above command only changes the device hdisk5 from an available state to a defined state, the definition information for the device is still saved in the ODM database, so clear the hdisk5 thoroughly with the following command

# remdev-l hdisk5-d

Fifth, volume group

1, create a volume group mkvg

# mkvg-y datavg-d 6-s 8 hdisk5 hdisk6 hdisk7

Create a volume group datavg that contains three physical volumes for hdisk5 hdisk6 hdisk 7 with a physical partition (pp) size of 8m, which requires a maximum of six physical volumes in the volume group.

If a disk used to belong to another vg, you can use the-f parameter to create a vg, such as:

# mkvg-y datavg-f hdisk3 hdisk4

# smit mkvg can also create volume groups.

2, display volume group

# lsvg displays all volume groups in the system

# lsvg-o displays the active volume groups in the current system

# lsvg rootvg displays specific information of volume group rootvg

# lsvg-l rootvg displays logical volume information in volume group rootvg

# lsvg-p rootvg displays the physical volume information in the volume group rootvg

# lsvg-I read volume group names from standard devices

# lsvg-o | lsvg-I-l displays all logical volumes in all volume groups

3. Modify volume group attributes

# chvg-ay datavg sets the volume group to be activated automatically when the system starts

# chvg-an datavg setting Volume Group cannot be automatically activated when the system starts

# chvg-u datavg may cause running lvm commands to end abnormally due to system problems, which may cause some volume groups to be locked.

# chvg-L 256 datavg modifies the LTG size of the volume group datavg. LTG is a concept of disk write operation, which is equivalent to the maximum transmission unit of disk I _ write O allowed. Currently, AIX5L supports 128kb, 256kb, 512kb and 1024kb sizes. To view the LTG of a physical volume, the lquerypv command with the-M parameter is available

# / usr/sbin/lquerypv-M hdisk0

4, add disks to the volume group

# extendvg datavg hdisk6

If the hdisk6 state is defined but is unavailable (viewed with lsdev-Cc disk6), the extendvg command will not succeed, so use the following command to modify the state of the physical volume

# mkdev-l hdisk6

If the disk once belonged to another volume group, you can use the-f parameter to force the addition of disks such as:

# extengvg-f datavg hdisk6

5, remove a disk from the volume group

# reducevg datavg hdisk5 before removing hdisk5 from the volume group datavg with the reducevg command, you must delete all logical volumes on the hdisk5 with the rmlv command, or automatically delete all logical volumes on the volume using the-d argument. This command can also delete multiple physical volumes # reducevg datavg hdisk1 hdisk2 hdisk3 at a time

6. Activate / deactivate a volume group

# varyonvg datavg activate datavg Volume Group

# varyoffvg datavg deactivate datavg volume group

7, import or export (delete) volume group

In the AIX system, the definition information of the device is stored in the ODM database of the system. To import a volume group is to import the definition information of the volume group into the system and save it in the ODM database to let the system identify the volume group. Exporting a volume group deletes the definition information of the volume group from the system's ODM database, but its organizational structure is still saved in the VGDA of each physical volume of the volume group, indicating that exporting a volume group does not delete the data on the volume group. Delete only the definition information about the volume group in ODM.

Export volume group

# exportvg datavg uses exportvg to export datavg from the current system.

The exportvg command removes the file systems of the volume groups from etc/filesystems and does not delete the mount points of those file systems. If the volume group to be exported contains page space (paging space), it cannot be exported while the page space is in use. Volume groups can be exported only if the page space is made inactive with swapoff.

For example: # swapoff page space name

Or use the # chps-a n page space name to not activate automatically at startup, and then restart the machine

Import volume group (note: when the system is reinstalled, if you want to reuse the pre-installation data, you need to re-establish the past volume group with the following command, and then mount the logical volume)

# importvg-y datavg hdisk3

After the importvg command, you must specify a physical volume name (any physical volume that can identify the outgoing volume group), and the import command automatically finds all the physical volumes in the volume group through the VGDA of this physical volume. The importvg command fails when the specified volume group name already exists on the target system, and since two identical volume group names are not allowed in the system, you must specify a volume group name that does not exist in the system when running import. In addition, when running the command, you can not specify the volume group name, that is, without the-y parameter, the system will automatically assign a default name.

8. Mirror a volume group with the mirrorvg command

# mirrorvg-c 3 datavg mirrors the datavg. After execution, the datavg volume group will have 3 copies.

By default, the mirrorvg command mirrors the logical volume to any disk in the volume group, and if you want to save the mirrored copy to a specified physical volume, you must indicate the physical volume name, such as:

# mirrorvg-c 3 datavg hdisk3 hdisk4 mirrors on hdisk3,hdisk4.

By default, once the mirrorvg command is executed, the synchronization of the mirror replica must be completed before it is completed. You can use the-S parameter to put the synchronization in the background. Such as:

# mirrorvg-S-c 2 datavg hdisk4

To replace a bad disk (such as hdisk7) in a volume group, refer to the following set of commands:

# unmirrorvg datavg hdisk7 (delete all mirrors on hdisk7)

# reducevg datavg hdisk7 (delete physical volume hdisk7 from datavg)

# rmdev-l hdisk7-d (remove hdisk7 physical volumes from the system)

Then replace the disk, configure the new disk as a physical volume, and rename it hdisk7, then execute the following command:

# extendvg datavg hdisk7 (add hdisk7 physical volumes to the datavg volume group)

# mirrorvg datavg (mirror all logical volumes in the datavg volume group)

VI. Logical volume

1. Display logical volume information: logical volume control block (LVCB), which holds the important information of the logical volume, which is located at the beginning of the logical volume, accounting for 521 bytes. You can view the information in the logical volume using the getlvcb command.

# getlvcb hd6

2, displaying information about logical volumes

# lsvg-l rootvg (shows all logical volumes in a volume group)

# lslv mylv (displays the details of the logical volume mylv)

# lslv-l mylv (shows the physical volumes spanned by the logical volume mylv and their distribution on the physical volumes)

3, create a logical volume

# mklv-y baodata-c 2 datavg 20

Specify that the logical volume is named baodata and is created in datavg. The logical volume is mirrored with two copies and has 20 logical partitions. If each partition maps two physical partitions, 40 physical partitions are used. The default is the jfs file system, which can be specified with the-t parameter

4. Modify logical volume command chlv

# chlv-t jfs2 baodata (modify logical volume baodata to jfs2)

5. Delete logical volume

# rmlv-f baodata

6. Create the file system crfs parameter:-v (jfs or jfs2) the type of file system to create. The-g (volume group name) indicates that the file system is created in that volume group, and if you do not specify the name of the volume group, you must specify an unused logical volume name with the-d parameter. The-m MountPoint parameter indicates the mount point of the file system. Such as:

# crfs-v jfs2-g datavg-m / mnt/test-a size=1G

7, use the mkfs command to set up a file system on an existing device

Mkfs builds file systems only on logical volumes, not mount points.

Note: the function of the crfs command is to add a new file system to the system, and the function of the mkfs command is to turn an existing device into a file system. The crfs command calls the mkfs command, the crfs command first calls the mklv command to create the logical volume, then calls the mkfs command to establish the file system on the logical volume, creates the mount point at the same time, and finally records the newly created file system in the / etc/filesystems file. Mkfs only builds file systems on logical volumes, does not establish mount points, and does not record in / etc/filesystems

Such as:

# mkfs-V jfs2 / dev/baodata

8, delete the file system rmfs

The rmfs command removes the file system. If the file system is a journal file system (JFS or JFS2), the rmfs command removes the logical volume where the file system resides and the relevant sections in the / etc/filesystems file.

If the file system is not a JFS or JFS2 file system, this command removes only the relevant sections in the / etc/filesystems file. The FileSystem parameter specifies the file system to be removed, such as:

# rmfs / test

9. Modify the file system chfs

You can use the chfs command to increase the space of the file system, such as:

# chfs-a size=10000M / tmp or # chfs-a size=+1000M / tmp

Note:

Add logical volume to AIX Times error 0516-787extendlv: Maximum allocation for logical volume jdelv02 is 512.

When using the chfs-a size=xx / fs command to aix to add logical volumes, sometimes to a certain size, it will report 0516-787extendlv: Maximum allocation for logical volume jdelv02 is 512. Such a mistake

This is mainly because the maximum number of logical partitions allowed by a logical volume by default is 512, so the error of 0516 will be reported when the logical volume size exceeds this limit. Of course, you can check the lv to see if it is 512:

Using lslv to see:

# lslv jdelv02

The MAX LPs is 512, which really exceeds this limit.

We can use the smit tool to modify this limit:

Smit chlv== > Change a logical Volume== > Logical volume name== > F4 (select the lvname you want to modify) enter

Or use the chlv command to modify the number of logical partitions.

# chlv-x 1000 fslv00

Change the value in MAXIMUM NUMBER of LOGICAL PARTITIONS [1024], enter and see "OK" in the upper left corner.

Indicates that the modification was successful. After esc+0 exits smit, it increases again

# chfs-a size=100G / oradata02

Filesystem size changed to OK . Success. )

10, lsps can display the properties of page space (virtual memory)

Parameters:

-a displays the properties of all page spaces

-s displays an overview of page space, showing the total size of all page space and the average percentage used

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report