3 minutes to read Linux disk partitioning

Source: Internet
Author: User

A few days ago, I met a scene like this:

A server is provided as a virtual machine, the server disk space through the df-h to see only more than 30 g, but through fdisk-l see that there is a 160G of disk space is not mounted, so you need to not restart the premise of the 160G disk mount.

Have dealt with this problem several times before, but not for some time, and a little forgotten, take this opportunity to share this case, deepen memory.

Before we talk about this case, let's briefly talk about the logical volume management (LVM) knowledge involved in dealing with this problem.

Logical Volume Management LVM is a versatile hard disk system tool. No matter in Linux or other similar system, it is very useful. Traditional partitions use fixed-size partitioning, which is cumbersome to resize. However, LVM can create and manage "logical" volumes, rather than using physical hard disks directly. The administrator's flexible management of logical volumes can be scaled down and simple to operate without damaging the stored data. You can add a new hard disk to the LVM at will to directly extend the logical volume that already exists. LVM does not require a reboot to let the kernel know that the partition exists.

LVM uses a hierarchical structure, as shown in.

The top of the figure is first the actual physical disk and its partitioning and physical volume (PV) on it. One or more physical volumes can be used to create volume groups (VG). You can then create a logical Volume (LV) based on the volume group. As long as there is free space in the volume group, you can create logical volumes as you like. The file system is created on a logical volume and can then be mounted and accessed on the operating system.

Case: Disk expansion 1. View disk file free space and find only more than 30 free disk space
[Email protected] tomcat-atm]# df-h

2. See the disk space pair for more information, there is a 160G disk
[Email protected] tomcat-atm]# fdisk-l

3. Create a disk partition using the ' 8e ' type to make it available for LVM
[Email protected] tomcat-atm]# Fdisk/dev/sdb

4. Create a physical volume
[Email protected] tomcat-atm]# pvcreate/dev/sdbphysical Volume "/dev/sdb" successfully created
5. Check the creation of physical volumes
[Email protected] tomcat-atm]# Pvdisplay

6. Extended Volume Group
[Email protected] tomcat-atm]# vgextend centos/dev/sdbvolume Group "CentOS" successfully extended
7. Viewing volume groups
[Email protected] tomcat-atm]# Vgdisplay

8. Extending the LVM volume
[Email protected] tomcat-atm]# lvextend-l +100%free/dev/mapper/centos-rootsize of Logical volume Centos/root changed FR Om 35.47 Gib (9080 extents) to 185.50 Gib (47489 extents). Logical volume root successfully resized.
9. Expansion capacity
[Email protected] tomcat-atm]# Xfs_growfs/dev/mapper/centos-root

10. View disk space to see the success of the expansion


Want to learn Linux? There is a full set of Linux starter tutorials, plus group 485374463 immediately

3 minutes to read Linux disk partitioning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.