In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I. Literacy of knowledge points
Cent0S 7 enables LVM2 (Logical Volume Manager) by default, which divides a hard disk of the machine into two regions, sda1 and sda2, in which the partition sda1 is mounted as a system disk / boot with a small amount of space; sda2 is a physical volume and completely acts as a logical volume group VG (Volume Group) centos. In this logical volume group centos, three logical volumes LV (Logical Volume) root and home and swap are mounted to the root directory / and / home and swap, respectively. The file system XFS is established on the two partitions sda1 and sda2. As the default file system of RedHat, file system XFS also has its consideration and has become the mainstream file system after ext3,ext4.
The relationship between several concepts: M physical hard disk HD or partitions in the physical hard disk together form a logical volume group VG and storage pool, create N logical volume LV in the volume group VG, and create a file system such as xfs in a logical volume LV. Physical hard disk / partition and logical volume have the smallest basic addressing unit, and the default size of CentOS7 is 4MB, which corresponds to one by one, similar to link or variable reference, but the relationship between the two is not always the same, because the logical volume may be adjusted automatically because the physical hard disk may change. Creating volume groups and logical volumes writes the volume's information VGDA (volume group descriptor area, Volume Group Descriptor Area) at the beginning of the disk just like creating a partition for identification. The advantage of logical volume is that it shields the physical underlying support and is free to expand changes without worrying about the physical space limitations of the hard disk or partition, so there will be no problems such as backing up / extending the partition and reformatting the hard disk in order to expand the partition size.
Second, the troubles of the production environment
The blogger asked the IDC computer room to reinstall the system. Every time the request is good, when installing the system, do not allocate the disk by default, but the evil IDC computer room does not listen every time. It is estimated that it is lazy and lazy to mind so many things, and the default disk allocation is used every time. CentOS 7 default installation / home takes up too much space, the root directory is much smaller (only 50G), and the OpenStack installation and storage are in the root directory. Uploading a few images may use up space in your root directory. Unlike other file systems such as ext3,ext4 or reiserfs, there are commands (resize2fs,resize_reiserfs) that directly support reducing the size of the file system, and the default installation of xfs supports expanding but not shrinking space! I believe anyone who has dealt with the company's IDC computer room will secretly scold in his heart, but, uh, we still have to solve the problem of disk allocation, so today the blogger will bring you a way to move the disk.
Third, the operation steps of the big shift of the universe
1. Check the disk usage first.
As we can see from the figure above, the / home partition has 865G disks, while the root partition has only the default 50G. Our goal is to move this large fast storage of 865G to the root partition.
2. Back up the user data in / home, uninstall home, and delete the home logical volume
Note: umount / home if prompted that it cannot be uninstalled, there is a process occupying / home. Use the following command to terminate the occupied process:
Yum install-y psmisc / / install fuser
Fuser-mu / home / / execute this command to see the process ID occupying the / home partition
Kill-9 process ID / / kill-9 delete the corresponding process
3. View the available space of the volume group
We can see that the free space of the volume group is 864G, which is the size of the home partition that was uninstalled just now.
4. Create a new volume home,fdisk and format it as 8e, and the file system as xfs (also mount to / home)
L represents the size, and the default unit is M _ TX n, which represents the volume name. Here, centos is the volume group name established by default when the CentOS7 installation system is installed.
5. View the logical volume home
6. Check the space size of the volume group again
Command: vgdisplay / / We can see that the number here in Free PE / Size becomes 814.50GiB
7. Activate the volume group centos to make the newly created home logical volume effective.
8. Establish the xfs file system on the newly created logical volume home
Command: mkfs-t xfs / dev/centos/home
9. Hang the new logical volume home in the previous folder / home
10. Copy the previously copied things back to the newly built / home without rebooting
Command: mv / backup/* / home/
11. Finally, allocate the free extra space to the root volume and xfs_growfs the extended file system
The remaining 814G is now allocated to the root volume, leaving it idle; the + sign indicates an additional addition to the original, and the "+" is set to a specific amount.
12. Check the logical volumes and volume groups, so that the root space reaches 864G, compared with 50G before.
13. Activate the next volume group centos again
14. Df-h view, without using xfs_growfs to extend the file system, the disk does not recognize much space
15. Expand the root volume
16. Look at the size of the root, which is more than 800g.
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.