Labels: Dirty centos installation LVM
This article is first published in the dark world.
I am planning to learn about LVM logical volumes recently. I have never been familiar with it before and have watched many videos on this topic. But it has not been in-depth. No matter what you do today, first install the centos System on LVM.
LVM is a logical volume manager, which has three important concepts: PV, VG, and LV.
PV indicates that the physical volume is the bottom layer of the entire LVM.
VG indicates a volume group. A volume group is created on one or more PVS.
LV indicates the logical volume. It is recommended that the logical volume be in the volume group. One or more LV can be created on one volume group.
Now, we know so much about installing centos on LVM.
Now we start to install centos. This experiment is still performed on the KVM virtual machine.
Log on to the KVM server and create the hard disk required for centos installation. Run the following command:
Qemu-IMG create-F qcow2/vhostdisk/testlvmos. IMG 10g
650) This. width = 650; "Title =" clip_image001 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image001 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918529D8vC.png "width =" 787 "Height =" 102 "/>
After the hard disk is created, install centos with the following name:
Virt-install-N testlvmos-r 2048 -- vcpus = 2 -- OS-type = Linux -- accelerate-C/ISO/CentOS-6.5-x86_64-minimal.iso -- Disk Path =/vhostdisk/testlvmos. IMG, format = qcow2, bus = ide -- Network Bridge = br0 -- VNC -- vncport = 5994 -- vnclisten = 0.0.0.0 -- force -- autostart
650) This. width = 650; "Title =" clip_image002 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image002 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918531mSRZ.png "width =" 1200 "Height =" 149 "/>
Use the VNC client to connect to the KVM Virtual Machine and install centos as follows:
650) This. width = 650; "Title =" clip_image003 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image003 "src =" http://img1.51cto.com/attachment/201408/13/526870_14079185362DKH.png "width =" 660 "Height =" 547 "/>
650) This. width = 650; "Title =" clip_image004 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image004 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918537freC.png "width =" 740 "Height =" 467 "/>
650) This. width = 650; "Title =" clip_image005 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image005 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918542BxCn.png "width =" 1044 "Height =" 835 "/> 650) This. width = 650; "Title =" clip_image006 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image006 "src =" http://img1.51cto.com/attachment/201408/13/526870_14079185445dK4.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image007 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image007 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918545TXpf.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image008 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image008 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918547I6xR.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image009 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image009 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918549YJWe.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image010 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image010 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918551Ks0j.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image011 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image011 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918554xx1W.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image012 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image012 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918555PYSd.png "width =" 1044 "Height =" 835 "/>
The above operations are not described here. The following is the main character of today. In the partition, we select Custom partitions as follows:
650) This. width = 650; "Title =" clip_image013 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image013 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918559RUhc.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image014 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image014 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918561IVzJ.png "width =" 1044 "Height =" 835 "/>
We can see that the current hard disk is 10 Gb in total. My current partitioning scheme is/boot partition, which is separately partitioned and gives MB space, not in LVM. All other partitions are in LVM.
First, separate/boot. As follows:
650) This. width = 650; "Title =" clip_image015 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image015 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918563YjkA.png "width =" 770 "Height =" 625 "/>
650) This. width = 650; "Title =" clip_image016 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image016 "src =" http://img1.51cto.com/attachment/201408/13/526870_14079185642JdY.png "width =" 520 "Height =" 480 "/>
Now the/boot partition has been split, and there is about MB of free space remaining, as shown below:
650) This. width = 650; "Title =" clip_image017 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image017 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918566TS37.png "width =" 666 "Height =" 266 "/>
Next we will create all the space remaining for the SDA hard disk, sda2, as the PV physical volume, as shown below:
650) This. width = 650; "Title =" clip_image018 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image018 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918568JS23.png "width =" 707 "Height =" 489 "/>
650) This. width = 650; "Title =" clip_image019 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image019 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918569GBQC.png "width =" 519 "Height =" 485 "/>
After the physical volume is created, the current partition of the hard disk is as follows:
650) This. width = 650; "Title =" clip_image020 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image020 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918571zGhG.png "width =" 746 "Height =" 247 "/>
Now let's create the volume group vg1, as shown below:
650) This. width = 650; "Title =" clip_image021 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image021 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918573lKTT.png "width =" 695 "Height =" 515 "/>
At the same time, add the physical volume sda2 to the volume group vg1 as follows:
650) This. width = 650; "Title =" clip_image022 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image022 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918574nWRS.png "width =" 565 "Height =" 493 "/>
After the volume group is created, the current hard disk partition is as follows:
650) This. width = 650; "Title =" clip_image023 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image023 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918576bEK8.png "width =" 593 "Height =" 237 "/>
Create the LV logical volume as follows:
650) This. width = 650; "Title =" clip_image024 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image024 "src =" http://img1.51cto.com/attachment/201408/13/526870_14079185784P8g.png "width =" 720 "Height =" 540 "/>
We first create a swap partition on the LVM to give 20 48 m space, and name the logical volume as logvol00, as shown below:
650) This. width = 650; "Title =" clip_image025 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image025 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918579dKT5.png "width =" 371 "Height =" 244 "/>
650) This. width = 650; "Title =" clip_image026 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image026 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918581xgkR.png "width =" 586 "Height =" 317 "/>
In the same way, create the root partition and allocate MB space to the LVM, and name the logical volume logvol01 as follows:
650) This. width = 650; "Title =" clip_image027 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image027 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918582M0t4.png "width =" 620 "Height =" 251 "/>
After the preceding partitions are completed, the LVM still has 2688m space. We will keep it for the time being. Continue to install the system as follows:
650) This. width = 650; "Title =" clip_image028 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image028 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918585xyge.png "width =" 1044 "Height =" 835 "/> 650) This. width = 650; "Title =" clip_image029 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image029 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918587X456.png "width =" 1044 "Height =" 835 "/>
650) This. width = 650; "Title =" clip_image030 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image030 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918590B9Ck.png "width =" 1044 "Height =" 835 "/> after the system is installed, restart and log on to the system, run the DF command to view the information as follows:
650) This. width = 650; "Title =" clip_image031 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image031 "src =" http://img1.51cto.com/attachment/201408/13/526870_1407918591pOgF.png "width =" 488 "Height =" 124 "/>
We can see that the root partition is indeed under LVM. We can also use the LVS and lvdisplay commands to view the logical volume information, as shown below:
650) This. width = 650; "Title =" clip_image032 "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; padding-Right: 0px; border-top-width: 0px; "Border =" 0 "alt =" clip_image032 "src =" http://img1.51cto.com/attachment/201408/13/526870_14079185936KPO.png "width =" 562 "Height =" 557 "/>
This article from the "muddy world" blog, please be sure to keep this source http://ilanni.blog.51cto.com/526870/1539535