Basic virtualization server templates use the online extended basic storage after CENTOS6 MINI edition is installed

Source: Internet
Author: User
Tags egrep

The basic virtualization server template uses the CENTOS6 MINI version to install the online extended basic storage. The virtual machine is used as a CENTOS6.3 MINI version system, with only 8 GB hard disks. It can be used as the "Basic Template" of the system. However, if it is used as another application, I am afraid the space is insufficient. If FTP (file service) is used, it is natural to have more space, and hard disk addition is indispensable. How to add it? LVM is the first choice. As long as the 6.3 system is installed normally, the LVM layout is automatically completed in the system. Just attach a hard disk to the corresponding location of the Virtual Machine (of course, it is also a virtual transfer to this virtual server !) Note: You need to enter the system and REBOOT the system to view the newly added hard disk. Here is my situation: i. Partition fdisk-l # The New/dev/sda/sda1 and/sda2/dev/sdbfdisk/dev/sdb # partition> n # Add a partition> p # What are the primary partitions? 1 ~ 4. You can choose from. Note: The next step is to set the size. The default value is 1, and then the end is set according to the actual size. (I add the entire hard disk together)> t # change the system ID of the partition to "8e", that is, Linux LVM> w # write it, don't forget, otherwise it will be done in white. 2. Create a physical volume. Note: The preparation is to use pvdisplay to check which physical volumes are currently available and perform subsequent operations. Pvcreate/dev/sdb1 # sdb1 is the created partition. 3. Perform volume group management. Note: Use vgdisplay to check the name of the currently used volume group and perform subsequent operations. Vgextend VolGroup/dev/sdb1 # VolGroup is the name of the volume group. In this line, add the new physical volume to the existing volume group. Note: the preparation is to use lvdisplay to check which logical volumes are currently available, and then perform subsequent operations. Lvextend-L + 100G/dev/VolGroup/lv_root # lv_root is the logical volume where I want to add space, this line adds the space to the volume group to the logical volume by GB. Note: When adding GB, it is best to reduce the space by 1 GB. Otherwise, an error will occur and cannot be added. Well, let's look at the following example: ------------------------------------------------------------ to add a GB disk to LVM. The previous operation is easy to complete. An error is reported in lvextend-L + 200G/dev/localhost/root. The error message is Insufficient free space: 51200 extents needed, but only 51199 available error indicates that only 51199*4 MIB/1024 is available, and 51200*4 MIB cannot be extended. After calculation, the value of 51199 × 4Mib/1024 is approximately equivalent to 199.99 GB. The command lvextend-L + GB/dev/localhost/root is run without an error, the system prompts you to execute the resized command Logical volume root successfully resized --------------------------------------------------. After adding the command, df-h cannot see new space and needs to be activated. Methods for different LINUX versions: RHEL 4: ext2online/dev/VolGroup00/LogVol00RHEL 5: resize2fs-p/dev/VolGroup00/LogVol00 resize2fs-p/dev/VolGroup/lv_root # Here is the prompt: resize2fs 1.41.12 (17-May-2010) filesystem at/dev/VolGroup/lv_root is mounted on/; on-line resizing requiredold desc_blocks = 1, new_desc_blocks = 7 specify Ming an on-line resize of/dev/VolGroup/lv_root to 27658240 (4 k) blocks. the filesystem on/dev/Vol Group/lv_root is now 27658240 blocks long. iv. Check Availability first use fdiskfdisk-l Disk/dev/sda for DFdf-h partition space: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x000855ab Device Boot Start End Blocks Id System/dev/sda1 * 1 64 5120 00 83 LinuxPartition 1 does not end on cylinder boundary. /dev/sda2 64 1045 7875584 8e Linux LVM Disk/dev/sdb: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0xe4f0a131 Device Boot Start End Blocks Id System/ Dev/sdb1 1 13054 + 8e Linux LVM Disk/dev/mapper/VolGroup-lv_root: 104856223 GB, 113.3 bytes255 heads, 63 sectors/track, 13773 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00000000 Disk/dev/mapper/VolGroup-lv_swap: 1073 MB, 1073741824 bytes255 heads, 63 Sectors/track, 130 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal ): 512 bytes/512 bytesDisk identifier: 0x00000000 ============================================ ============= other records: cat/etc/fstab commands: Extension vg: vgextend vg0 (volume group name)/dev/sdc1 (pv name) Extension lv: lvextend-L + 200 m/dev/vg0/home (lv name) view information: vgdisplay/dev/vg0, lvdisplay/ Dev/vg0/logVol00 data migration: pvmove/dev/sda1/dev/sdc1 Delete logical volume step:. umout all lv B. lvremove/dev/vgo/logVol00 (if a snapshot is available, delete the snapshot first) C. vgchange-an/dev/vg0 (sleep vg0,-ay is activated vg0) D. vgremove vg0 (remove) Note: during migration, note that PE and LE correspond one to one, and the size must be the same. during migration, the size cannot be changed. Check how much space is not allocated in vg and the current lv size. vgdisplay | egrep "Volume group | VG Name | Alloc PE | Free PE" lvdisplay | egrep "Logical volume | LV Name | VG Name | LV Size "to mount it to the desired location

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.