CentOS under 7 LVM Logical Volume Manager

A, Introduction to LVM
LVM is a Linux system on a logical disk partition management mechanism, which is built on the hard disk and partition, a logical layer below the file system, shielding the underlying disk partition when creating the file system layout, can dynamically adjust the disk capacity while maintaining the existing data unchanged, thereby increasing the flexibility of disk management.

Some basic terms LVM
PV: storage device physical volume is substantially LVM mechanism, generally corresponding to a normal hard disk or the entire partition. When creating a physical volume will be created in the head of the hard disk partition or a partition reserved for the LVM attribute record, and the storage space is divided into units the size of the default base 4MB, which constitutes the physical volume.

VG: by one or more physical volumes as a whole, is called volume group can be dynamically added or removed physical volumes in the volume group. .

LV: logical volume is built on volume groups, and physical volumes are not directly related.

As it can be seen by the interpretation of the physical volume, volume group, logical volume above established procedure LVM partition management mechanism: creates a common partition for the first physical volume; Next a plurality of physical volumes entire logical group; based on final volume this whole group, divided different data storage space, forming the logical volume. Logical Volume is the end-user to format and mount the storage unit to use.

CentOS under 7 LVM Logical Volume Manager

Second, management LVM
first create three new disks to them as the basis of our experiments behind.
CentOS under 7 LVM Logical Volume Manager

The disk has been added to our host, the first thing to do is to let the disk partition. We turn to three disk partitioning process, and modify the file format type is LVM format.
CentOS under 7 LVM Logical Volume Manager
CentOS under 7 LVM Logical Volume Manager

Here, we complete the first disk partition in no hurry to format, in order to create a logical partition First of all we want to create a disk partition as a physical volume.
CentOS under 7 LVM Logical Volume Manager

Physical volume is created, and here we have to do is add them to a volume group inside.
CentOS under 7 LVM Logical Volume Manager

After completion of the volume group we can create a logical partition on the volume group.
CentOS under 7 LVM Logical Volume Manager
CentOS under 7 LVM Logical Volume Manager

Create a logical partition for some reason when we will consider the capacity for logical partitions ill, so we also need to learn how to extend the logical partitions.
CentOS under 7 LVM Logical Volume Manager

At this point we have completed the disk partition, here we need to format a partition deal.
CentOS under 7 LVM Logical Volume Manager

Here's what we mount on a disk partition, first we need to create a mount point for the partition, followed on a disk partition to mount automatically mount and view the results.
CentOS under 7 LVM Logical Volume Manager
CentOS under 7 LVM Logical Volume ManagerCentOS under 7 LVM Logical Volume Manager

Third, the disk quota
disk quota restrictions, there are two ways, one is the capacity of the other nodes, each of which in turn are divided into soft and should be limited. The soft limit can be exceeded but the excess part limited in time, should limit can not be exceeded. Here we have the / opt / mbox2 example to demonstrate the operation.

Before making disk quota we must first check to see if our system has been installed xfsprogs, and whether there xfs_quota command xfsprogs in.
CentOS under 7 LVM Logical Volume Manager

Before disk quotas, we also need to turn off security features of the system, because in some versions of the security features that may affect us write function disk quota file.
CentOS under 7 LVM Logical Volume Manager

Preparations are completed, here we have to do is mount the work, and we need to usrquota grpquota permanently mounted to mbox2 below.
CentOS under 7 LVM Logical Volume Manager
CentOS under 7 LVM Logical Volume Manager

But when we found that after the completion of the mount under mbox2 not usrquota and grpquota.
CentOS under 7 LVM Logical Volume Manager

Then we need to re-mount the mbox02, so usrquota and grpquota will mount successfully.
CentOS under 7 LVM Logical Volume Manager
CentOS under 7 LVM Logical Volume Manager

Now we can set disk quotas, we first of all restrictions on soft and hard disk capacity, respectively 50M and 80M, soft and hard limit node 4 and 6, respectively.
CentOS under 7 LVM Logical Volume Manager

After the completion of the disk quota we also need to be verified, because the user is zhangsan for us, so we have to switch to zhangsan user, but the user mbox2 and zhangsan not have write access, so we also need permission before switching to the mbox2 to modify.
CentOS under 7 LVM Logical Volume Manager

First, we verify the disk nodes found after the establishment of six documents that we will not create the document again, the node limit our disk quota is successful.
CentOS under 7 LVM Logical Volume Manager

After that, we then limit the capacity of the disk quota is verified, we copied from zero to mbox2 data found in the data replication over 80M is also unable to continue copying, thus we can see that the same limit our capacity to be successful.
CentOS under 7 LVM Logical Volume Manager

After the disk capacity limit is reached we will try to create a document found in the document can not be created, so that I can ask, when the disk quota limit capacity and node one another to reach the hard limit operating the same can not be operated.
CentOS under 7 LVM Logical Volume Manager

The last step allows us to view disk quota results, enter this command before we need to switch back to the administrator user.
CentOS under 7 LVM Logical Volume Manager

Guess you like

Origin www.linuxidc.com/Linux/2019-08/160372.htm