Online File System resizing is one of the most common operations in system management. It is helpful to better understand AIX management by mastering the corresponding commands.
Create a logical Volume LV and a file system.
There are two methods here. One is to first create a logical Volume LV with mklv, then create a file system with mkfs, and the other is to directly use crfs to create the LV together with the file system.
Through the actual operations on these two methods, we found that: 1. mklv can customize the name of the logical Volume LV, and I haven't found out where to specify the name of the automatically created LV using crfs, the default value seems to start from fslv00, and the subsequent numbers are increased sequentially. In addition, when using crfs, it seems that the number of LV copies images that it automatically creates cannot be specified. 2. Use mkfs to create a logical volume obtained from mklv. It does not go to/etc/filesystems (the function of this file is equivalent to the/etc/fstab file in linux) this file contains information about the new file system. No information about the new file system is found in this file, which may cause two problems: first, when you use the lsfs command to view the partition, the file system you just created will not be displayed (because lsfs is a directly read/etc/filesystems file ), second, when chfs is used to resize a partition, it will reject it because/etc/filesystems does not contain the file system information. However, this is not a problem because you can manually add the information of the file system created through mkfs to/etc/filesystems in the file format. 3. When I used smit crfs to create JFS from previusly Defined Logical Volume, I found that it did not recognize the Logical Volume I created using mklv manually. Somehow.
Therefore, we can draw a conclusion that if you want to customize the created LV, you need to use mklv + mkfs and then manually add the information in/etc/filesystems, if you want to make it simple and fast, it is better to use crfs.
Then, resize the file system online.
The lsvg testvg command can be used only when vg is active (varyonvg testvg can be used for activation), or lspv can be used to check whether the vg corresponding to hdisk is active.
Verify that the file system is successfully resized. I used the df-g command to view the space of the file system, at the same time, lslv fslv00 is also used to check the number of LP logical partitions of the LV to check the number of LP allocated.
There are two types of resizing: one is to resize LV (using the extendlv command), that is, to increase the number of logical partition LP, and the other is to resize the File System (using the chfs command ), is to increase the space of the file system that df-g sees. I didn't quite understand these two methods before. After the subsequent operations, I found that: 1. extendlv simply increases the number of logical partition LP, if the corresponding LV has already created a file system and mounted it before resizing, the capacity of the file system mounted after extendlv will not change (even if it is remounted ), this will not automatically resize the file system. 2. To expand the file system size, you must use the chfs command. You can use the chfs-a size = 800 M/home/fslv00 command to resize the file system. At the same time, I also found that the command method of adding a partition of MB space in chfs-a size + = m was not successful, it prompts that the format of Attribute = Value must be used, I do not know why. After chfs, run df-g to check the file system, and the space of the file system becomes larger. The extendlv can no longer be used to increase the LP. 3. There is a problem here. the actual capacity of the file system or logical partition = the PP size of the physical partition * The number of logical partitions, so the size specified by chfs is used, the system does not necessarily allocate so much space, which is not less than the user-specified capacity and closest to the physical partition Multiple capacity, because the physical partition PP size is fixed and cannot be changed, therefore, the capacity can only be a multiple of physical partitions. If the PP size of the current VG is 512 MB, the system will allocate 1 GB space to me if I specify 800 MB, because the capacity is not less than MB and the maximum size close to MB is 1 GB. 4. Using chfs, it will automatically expand the LV, that is, it will automatically increase the number of logical partition LP. Therefore, for file system extensions, you only need to use chfs. extendlv is not necessary at all. 5. Why do you need the extendlv command? Because there is still a bare device, for example, oracle will directly use the bare device without creating a file system. If the logical partition LV of the bare device corresponding to oracle is not enough, the extendlv command comes in handy. Because the bare device does not have a file system, chfs modifies the file system and is naturally unusable. 6. What if I want to use extendlv and chfs together? The result is that the operation Priority of chfs on the number of LP is higher than that of extendlv. The direct result is that chfs will modify the number of LP modified by extendlv. For example, there was only one LP for the LV before resizing. I first used extendlv to increase the LP to two. If I use chfs to resize the file system to the size of just two LP, what will happen? The result is that it only uses two LP, there will be no extended LP from extendlv, and a new LP is added to chfs, resulting in a total of three lp s, but only two LP s can be used, therefore, we can see that chfs has a higher priority for LP operations than extendlv. For another example, there is only one LP for the LV before expansion. I used extendlv to add seven LP s for the LV, that is, there are now eight LP S, now I use chfs to resize the file system to four LP-sized spaces. What will happen? The result is that the LV has only four LP s, that is, chfs changes the number of lv lp s to the size of the four lp s specified by the user, and the number of LP s previously set by extendlv is overwritten.
All right, the resizing of the AIX file system and LV is also basically clear, and record it for backup.