In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "Centos7 how to use LVM to achieve dynamic expansion", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Centos7 how to use LVM to achieve dynamic expansion" article.
Knowledge reserve:
Lvm is the abbreviation of logical disk Volume Management (logical volumemanager). It is a mechanism for managing disk partitions in linux environment. Lvm is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. Lvm system administrators can easily manage disk partitions, such as connecting several disk partitions into a single block volume group (volumegroup) to form a storage pool. Administrators are free to create logical volume groups (logicalvolumes) on volume groups and further create file systems on logical volume groups. Administrators can easily resize storage volume groups through lvm, and disk storage can be named, managed and allocated according to groups.
The lvm model is shown below:
1. When installing os, select manual partitions and device type select lvm. Mysql/mariadb data is stored in / var,oracle data is stored in / home, so when partitioning manually, please make the / var and / home scores larger according to the actual disk size. The following zoning is for demonstration purposes only:
two。 After installing os, enter the system and look at the partition. You can see the three partitions in which the system is installed with lvm: /, / home, / var
3. I forgot to create a root account when installing os, but it doesn't matter. Execute 'sudosu root', and then enter the login user password to get some root permissions.
4. View volume group name and volume group usage vgdisplay
5. View the space status of the current logical volume, as shown below: / 50g, / var 200g, / home 100g, swap 20g
6. Now it feels like / home 100g is not enough. If you want to expand the capacity to 120g, insert a new 20g hard disk; check it with 'fdisk-1'.
7. Format partition operation 'fsdisk/dev/sdb'
8. Set the newly added disk to lvm mode
Confirm the partition
9. Create the newly added partition / dev/sdb1 as a physical volume
10. Expand the volume group 'cl', and extend the physical volume / dev/sdb1 to the' cl' volume group
At this point, volume group 'cl' has 20g free space, and / dev/sdb1, extend it all to / home
11. At this point, although 20g disk has been extended to / home, it is not written to the file system; enter / etc/fstab confirm / home file system-> ext4
twelve。 Write to the file system to make the expansion effective
13. If it is a xfs file system, use 'xfs_growfs / dev/mapper/cl-home'; to view / home, and the capacity has been expanded. The great task has been completed!
Summary of this expansion instruction:
1. Create partition # fdisk / dev/sdb
two。 Create a physical volume # pvcreat / dev/sdb1
3. View volume group name and usage # vgdisplay
4. Extend the physical volume to the volume group # vgextend cl / dev/sdb1 (where 'cl' is the volume group name)
5. Expand the free space in the volume group to / home # lvextend-l + 100%free / dev/mapper/cl-home
6. Refresh the file system is the expansion takes effect # resize2fs / dev/mapper/cl-home
Using the reiserfs file system instead of ext2/ext3 # resize_reiserfs / dev/mapper/cl-home
The default file system for centos7 is' xfs', I chose 'ext4' when partitioning
Project practice:
Mpx run disk will / write full, resulting in gui can not get in, using this method to / dynamic expansion, gui back, ha ha ha
Before capacity expansion
After expansion
Gui is back.
Also attached is some personal understanding of the linux partition:
In linux, everything is a file, and all devices and disks are hung in the form of a file. For the / var mentioned in this article, if you do not partition / var manually when installing os, the system will create / var by default, but the maximum available storage space for the / var created by the system is'/'. In addition, only the boot files of linux os are stored in / boot or / boot/efi, so there is no need to divide them too large.
The above is about the content of this article on "how to use LVM to achieve dynamic expansion of Centos7". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.