LVM uses LVM to manage and use disks. All disks are based on LVM.
After a disk is attached to a system disk, it cannot be directly used by LVM. Therefore, it must be changed to a physical volume that AIX can recognize. 1. After the instance is shut down, the disk is added to the system. During the Startup Process of AIX, The cfgmgr is automatically called to identify the disk. after entering the system, use lspv to view the disk, the attached disk does not have the PVID (Physical Volume Identifier). It cannot be used by LVM. It needs to be converted to a Physical Volume and assigned a PVID automatically by the system. 2. Add the disk to the system online (without restarting the system). If the disk array is added to the system and the hdisk is not visible to the lspv, You need to manually execute ipvmgr to enable the system to identify the disk array. Configure the disk as a physical volume and assign PVID: # chdev-l hdisk1-a pv = yes
To delete a physical volume from the system, you must first set the physical volume to unavailable state: Use the chpv command to set the PV to unavailable state: # chpv-v r hdisk1 //-v parameter, that is, availability sets PV to available status: # chpv-v a hdisk1
The status of the physical volume that can be allocated to the volume group. Unallocable: # chpv-a n hdisk1 //-a parameter, that is, allocation allocable: # chpv-a y hdisk1
Delete the physical volume # rmdev-l hdisk1. If the device is available, it becomes defined. If the device is defined, it becomes undefined. # Rmdev-l hdisk1-d the-d parameter is used to completely delete the definition of the physical volume from the ODM.
Create a volume group by performing volume group operations: You must have at least one physical volume not allocated with VG-> before creating the mkvg command, you must prepare several parameters for the volume group to be created: volume group name (-y parameter), physical partition PP size (-s parameter), whether VG is automatically activated when the system starts (-n parameter) # mkvg-y 'testvg '-s '4' hdisk10 hdisk12 // VG name testvg, PP size 4 MB, add hdisk10, 12 to the volume group
Delete volume group: no command can be used to directly delete a volume group. You can only use the reducevg command to delete physical volumes in the VG one by one. When the last PV is deleted, the entire VG is deleted.
Volume group resizing (Common Operations) # extendvg testvg hdisk10 // Add hdisk10 to the testvg volume group. The newly added hdisk10 must not belong to any VG; otherwise, it will fail.
# Reducevg testvg hdisk10 // Delete hdisk10 from the tesgvg volume group. The-d parameter is used to automatically delete all logical volumes on the physical volume before deleting the physical volume. The-f parameter is directly deleted without the user's confirmation. when the logical volume on the physical volume deletes the PV in the VG, the volume group must be in the active state (varyon ). If the physical volume to be deleted has a logical volume, or even the logical volume exceeded other PVS in VG, the delete operation will destroy the logical volume.
Reorganizing logical volumes in the volume group to improve performance # reorgvg testvg fslv00 // reorganizing the fslv00 logical volumes in the testvg volume group
Activate and disable the volume group # varyoffvg datavg // disable the datavg volume group # varyonvg datavg // activate the datavg volume group-f force activate the volume group, even if the VGDA status is inconsistent-n prohibits the synchronization volume group (syncvg) operation during the activation of the volume group to avoid greater damage to synchronization-s activates the volume group in maintenance mode, after activation, you can perform volume group operations, but cannot open any logical volumes.
# Exportvg datavg // export volume group # importvg-y datavg hdisk12 // import volume group
Create a logical volume. Run the mklv command-c copies to specify the number of copies of the logical volume. The default value is 1, the maximum value is 3-y NAME. specify the NAME of the logical volume. LPs specifies the number of logical partitions of the logical volume. # mklv-y lvfs01-c 2 rootvg 10 // create the NAME lvfs01 on rootvg, logical volume with 2 images and 10 logical partitions
To delete a logical volume, run the rmlv command-f to force the delete operation. You do not need to confirm that-p PV only deletes the logical partitions on the specified PV, do not delete the logical volume # rmlv lvfs01 // Delete the logical volume of lvfs01
Logical volume space size adjustment logical volume space size = number of logical partitions x size of physical partition PP size physical space occupied size of logical volume = number of logical partitions x number of logical volume images x number of physical partition PP size
Extended logical volume size use the extendlv command # extendlv lvfs01 10 // Add (expand) 10 logical partitions of the logical volume lvfs01
AIX does not directly reduce the size of logical volumes,
The file system AIX supports four file systems: JFS/JFS2, NFS, GPFS, and CDRFS. JFS/JFS2 consists of these parts: super block, index node I-nodes, data block, and file system log. The I-nodes table contains the index numbers of all files in the file system. When a user accesses a file, UNIX first finds the corresponding file I-nodes number through the I-nodes table, access the corresponding file data and maintain the I-nodes. To view the I-nodes information, you can use istat/filesystem or ls-I.
You can use mkfs or crfs to create a file system. The difference is that mkfs only creates a file system on the created LV, crfs can directly create LV and file system, with more functions. Crfs parameters:-v file system type, size of the file system VG-a in the volume group where the JFS/JFS2-g file system is located, adjust by integer multiple of logical partitions-mount point of m file system-whether the new file system created by A is automatically installed at system startup-the new file system is read-only (ro) or read/write (rw) installation. # Crfs-v jfs2-g datavg-a size = 100 M-m/test // create a LV and file system of jfs2 with a mount point of M/test on datavg
File System deletion: First umount and then rmfs
Dynamic capacity expansion of the file system: chfs. The only requirement is that the file system is in a volume group and there is sufficient free space (free PP ). # Chfs-a size = + 100 M/test // Add 100 M to the/test File System
Fsck should not be mounted to the file system before checking and repairing file system errors. If the super block of the AIX file system is damaged, you only need fsck-y or fsck-p to fix it.