Vmware CentOS virtual machine root partition disk expansion (based on LVM)

Source: Internet
Author: User
Tags deprecated

Because the development test machine dev-vhost017 root partition plan is insufficient only 10G, needs to enlarge. (based on LVM)

Turn off dev-vhost017 and then adjust the root partition drive 10G to 50G in vsphere Client

Turn on the virtual machine
Original/Size 10G

[Email protected] ~]# df-hfilesystem            Size used Avail use% mounted on/dev/mapper/vg_centos6-lv_root                      8.3g< c3/>4.0g  3.9G  51%/tmpfs                 939M   12K  939M   1%/dev/shm/dev/sda1             477M   57M  396M  13%/boot


View disk SDA extended to 50G
[[email protected] ~]# fdisk/dev/sdawarning:dos-compatible mode is deprecated. It ' s strongly recommended to switch off the mode (command ' C ') and change display units to sectors (Comman d ' u '). Command (M for help): pdisk/dev/sda:53.7 GB, 53687091200 bytes255 heads, sectors/track, 6527 cylindersunits = Cylinde RS of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes           s/512 bytesdisk identifier:0x0007ef5b Device Boot Start End Blocks Id system/dev/sda1 * 1 512000 linuxpartition 1 does not end on cylinder BOUNDARY./DEV/SDA2 64 13 9972736 8e Linux lvmdisk/dev/mapper/vg_centos6-lv_root:9135 MB, 9135194112 bytes255 heads, sectors/track, 1  Cylindersunits = Cylinders of 16065 * 8225280 bytessector size (logical/physical): bytes/512 bytesi/o Size (minimum/optimal): bytes/512 bytesdisk identifier:0x00000000disk/dev/mapper/vg_centos6-lv_swap:1073 MB, 1073741824 bytes255 heads, sectors/track its = cylinders of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o Size (minimum/optim   AL): bytes/512 bytesdisk identifier:0x00000000


View LVM Status
[[email protected] ~]# PVs  PV         VG         Fmt  Attr PSize pfree  /dev/sda2 vg_centos6 lvm2  a--  9.51g    0 [[email protected] ~]# VGS  VG         #PV #LV #SN Attr   vsize vfree  vg_centos6   1   2   0 wz--n-9.51g    0 [[email protected] ~] # LVS  LV      VG         Attr       lsize Pool Origin data%  meta%  Move Log cpy%sync Convert  lv_root VG _centos6-wi-ao----8.51g                                                      lv_swap vg_centos6-wi-ao----1.00g


Partition/dev/sda3
[Email protected] ~]# fdisk/dev/sdawarning:dos-compatible mode is deprecated. It's strongly recommended to         switch off the mode (command ' C ') and change display units to         sectors (Command ' u '). C Ommand (M for help): pdisk/dev/sda:53.7 GB, 53687091200 bytes255 heads, sectors/track, 6527 cylindersunits = Cylinder  S of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes /Bytesdisk identifier:0x0007ef5b   Device Boot      Start         End      Blocks   Id  system/dev/sda1   *           1      512000  linuxpartition 1 does not end on cylinder boundary./dev/sda2        1306     9972736   8e  linux lvm/dev/sda3            1306        6527    41942367+  


[Email protected] ~]# Partprobe


Restart virtual machine format/dev/sda3
[Email protected] ~]# Mkfs.ext4/dev/sda3


LVM expansion

[[email protected] ~]# Pvcreate/dev/sda3 Physical Volume "/dev/sda3" successfully created[[email protected]             ~]# PVs PV VG Fmt Attr PSize pfree/dev/sda2 vg_centos6 lvm2 a--9.51g 0/dev/sda3 LVM2---40.00g 40.00g[[email protected] ~]# Vgextend/dev/mapper/vg_centos6/dev/sda3 (note group name) Volume Group "Vg_c ENTOS6 "Successfully extended[[email protected" ~]# lvextend-l 39.9g/dev/vg_centos6/lv_root/dev/sda3 Rounding si Ze to boundary between physical extents:39.90 GIB Size of logical volume Vg_centos6/lv_root changed from 8.51 GiB (2178  extents) to 39.90 GiB (10215 extents). Logical volume Lv_root successfully resized[[email protected] ~]# resize2fs/dev/vg_centos6/lv_root resize2fs 1.41.12 (17-may-2010) Filesystem at/dev/vg_centos6/lv_root is mounted on/; On-line resizing Requiredold desc_blocks = 1, new_desc_blocks = 3Performing an on-line resize Of/dev/vg_centos6/lv_root t o 10460160 (4k) blocks. The FileSystem ON/dev/vg_centos6/lv_root is now 10460160 blocks long.    [[email protected] ~]# PVs PV VG Fmt Attr PSize pfree/dev/sda2 vg_centos6 lvm2 a--9.51g 0   /dev/sda3 vg_centos6 lvm2 a--40.00g 8.60g[[email protected] ~]# vgs VG #PV #LV #SN Attr vsize vfree VG_CENTOS6 2 2 0 wz--n-49.50g 8.60g[[email protected] ~]# lvs LV VG Attr lsize Pool Ori                                                      Gin data% meta% Move Log cpy%sync Convert lv_root vg_centos6-wi-ao----39.90g Lv_swap vg_centos6-wi-ao----1.00g [[email protected] ~]# df-hfilesystem Size used Avai L use% mounted on/dev/mapper/vg_centos6-lv_root 40G 4.0G 34G 11%/TMPFS 939M 1 2 k 939M 1%/dev/shm/dev/sda1 477M 57M 396M 13%/boot




Vmware CentOS virtual machine root partition disk expansion (based on LVM)

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.