Linux performance optimization 18th: lvm is recommended
Source: Internet
Author: User
Linux Performance Optimization 18: lvm is recommended. linux performance optimization 17: Process binding and interrupt binding http://www.2cto.com/os/201307/230782.html I saw a post in the forum a few days ago about 20 GB of space in the partition of the system/home managed by the administrator... linux Performance Optimization 18: lvm is recommended. linux performance optimization 17: Process binding and interrupt binding http://www.2cto.com/os/201307/230782.html I saw a post in the forum a few days ago about 20 GB of space in the partition of the system/home managed by the administrator. the solution is to unmount the partition and divide a space larger than 20 GB, copy all the previous data to the new partition, and then mount it to the new partition! The problem is solved, but there is not enough space for a while. what should I do? Keep in mind that services cannot be provided externally during this operation! In linux, there is a disk partition management technology "logical volume", that is, the physical disk partition logic, users directly use the logical volume on the line, the feature is that you can freely stretch, reduce unnecessary service interruptions. Of course, after the administrator understands this, the problem will no longer be handled in the example I mentioned. Simple example of logical volume: physical disk layer:/dev/sda/dev/sdb ...... physical volume layer PV:/dev/sda1/dev/sdb2 ...... volume group layer VG: VG0 VG1 (here the name is random) logical volume layer LV: lvdata lvhome (for direct formatting) conversion process: First partition the disk, modify its type 8e. the partitions to be used. use pvcreate to generate pv. use vgcreate to generate a volume group. Finally, create a logical volume from the volume group. format the volume and use it! Note that one vg can correspond to multiple PVS. you can create multiple PVS in one vg. vg can expand by adding pv, and lv can be stretched by the remaining space in vg! For a simple example, you can also use the graphical tool system-config-lvm: 1. fdisk/dev/sdb partition and modify type 8e 2. pvcreate/dev/sdb1/dev/sdb2 generate physical Volume 3. vgcreate vgtest/dev/sdb {1, 2} generates a volume Group 4. lvcreate-L 400 M-n lvmnt vgtest 5. mkfs. ext4/dev/vgtest/lvmnt; mount/dev/vgtest/lvmnt/mnt/; format and mount the file. what if the/mnt m space is insufficient? Now we can use the logical volume expansion function! 1. first look at the size before expansion, about 400 M/dev/mapper/vgtest-lvmnt 407 M 11 M 375 M 3%/mnt 2. stretch logical volume: lvextend-L + 300 M/dev/vgtest/lvmnt note: do not think it is finished here. this is just to stretch the volume of lvmnt, the user needs to use the file system, so proceed to the next step 3. extended file system on the logical volume: resize2fs/dev/vgtest/lvmnt 4. view the results:/dev/mapper/vgtest-lvmnt 711 M 12 M 664 M 2%/mnt logical volume principle: Strip the physical disk partition, you can also use dmsetup!
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