CentOS disk resizing lvm

Source: Internet
Author: User
Tags gparted
CentOS disk resizing lvm installation Centos LVM space is quickly reduced, and it will not be enough soon. many people use Gparted resizing, and the command line is not easy to use, the Gparted of the graphic interface cannot be found on CentOS6.4; some people use the Gparted-Live disk, which is very troublesome. In fact, Lin... centOS disk resizing lvm installation Centos LVM space is quickly reduced, and it will not be enough soon. many people use Gparted resizing, and the command line is not easy to use, the Gparted of the graphic interface cannot be found on CentOS6.4; some people use the Gparted-Live disk, which is very troublesome. In fact, Linux itself provides a powerful and simple resizing tool, which is very easy: 0: current disk status: [root @ CentOS ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_centos-lv_root 5.5G 4.9G 375 M 93%/tmpfs 499 M 320 K 498 M 1%/dev/shm/dev/ sda1 485 M 56 M 404 M 13%/boottmpfs 499 M 0 499 M 0%/tmp/ram 1: view the hard disk to be added, which is/dev/sdb: [root @ CentOS ~] # Fdisk-l Disk/dev/sda: 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: 0x000d0b56 Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary. /dev/sda2 64 1045 8e Linux LVM Disk/dev/sdb: 7875584 MB, 8589 bytes255 heads, 63 sectors/track, 8589934592 cylindersUnits = cylinders of 1044*16065 = 512 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00000000 .....: 2: initialize the disk to be added: [root @ CentOS ~] # Pvcreate/dev/sdb Physical volume "/dev/sdb" successfully created 3: Add the new disk to LVM: [root @ CentOS ~] # Vgextend vg_centos/dev/sdb Volume group "vg_centos" successfully extended 4: view the LVM after adding a disk: [root @ CentOS ~] # Vgdisplay-v vg_centos Using volume group (s) on command line Finding volume group "vg_centos" --- Volume group --- VG Name vg_centos System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable max lv 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 15.50 GiB PE Size 4.00 MiB Total PE 3969 Alloc PE/Size 1922/7 .51 GiB Free PE/Size 2047/8 .00 GiB // how much space is available, is the new disk space vg uuid upgrade --- Logical volume --- LV Path/dev/vg_centos/lv_root LV Name lv_root VG Name vg_centos lv uuid jjByYP-BlFO-O70G-eYd9-Eupx-wqgS-AB2NNT LV Write Access read/write LV Creation host, time CentOS. host1, 11:33:27 + 0800 LV Status available # open 1 LV Size 5.54 GiB Current LE 1418 Segments 1 Allocation inherit Read ah Ead sectors auto-currently set to 256 Block device 253: 0 --- Logical volume --- LV Path/dev/vg_centos/lv_swap LV Name lv_swap VG Name vg_centos lv uuid eT8hdT-CbSj-5Kjx-1lyo-2Ru6-nB5o-fJ0HKU LV Write Access read/write LV Creation host, time CentOS. host1, 11:33:29 + 0800 LV Status available # open 1 LV Size 1.97 GiB Current LE 504 Segments 1 Allocation inherit Read ahead sectors auto- Currently set to 256 Block device 253: 1 --- Physical volumes --- PV Name/dev/sda2 pv uuid mEQ0cK-I0ja-45yS-fRqy-19Ds-0dr7-1CNFcx PV Status allocatable Total PE/Free PE 1922/0 PV Name/dev/sdb pv uuid ready PV Status allocatable Total PE/Free PE 2047/2047 5: extended logical volume (like windows extended logical volume): [root @ CentOS ~] # Lvextend-L + 7.9G/dev/vg_centos/lv_root Rounding size to boundary between physical extents: 7.90 GiB Extending logical volume lv_root to 13.44 GiB Logical volume lv_root limit resized 6: view the expanded LVM [root @ CentOS ~] # Vgdisplay-v vg_centos Using volume group (s) on command line Finding volume group "vg_centos" --- Volume group --- VG Name vg_centos System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable max lv 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 15.50 GiB PE Size 4.00 MiB Total PE 3969 Alloc PE/Size 3945/15 .41 GiB Free PE/Size 24/96 .00 MiB vg uuid upgrade --- Logical volume --- LV Path/dev/vg_centos/lv_root LV Name lv_root VG Name vg_centos lv uuid jjByYP-BlFO-O70G-eYd9-Eupx-wqgS-AB2NNT LV Write Access read/write LV Creation host, time CentOS. host1, 11:33:27 + 0800 LV Status available # open 1 LV Size 13.44 GiB Current LE 3441 Segments 2 Allocation inherit Read ahead sectors auto-curre Ntly set to 256 Block device 253: 0 --- Logical volume --- LV Path/dev/vg_centos/lv_swap LV Name lv_swap VG Name vg_centos lv uuid eT8hdT-CbSj-5Kjx-1lyo-2Ru6-nB5o-fJ0HKU LV Write Access read/write LV Creation host, time CentOS. host1, 11:33:29 + 0800 LV Status available # open 1 LV Size 1.97 GiB Current LE 504 Segments 1 Allocation inherit Read ahead sectors auto-currently set to 256 Bl Ock device 253: 1 --- Physical volumes --- PV Name/dev/sda2 pv uuid mEQ0cK-I0ja-45yS-fRqy-19Ds-0dr7-1CNFcx PV Status allocatable Total PE/Free PE 1922/0 PV Name/dev/sdb pv uuid ready PV Status allocatable Total PE/Free PE 2047/24 6: file system expansion (note that this must be done, because the above is only space expansion) [root @ CentOS ~] # Resize2fs/dev/vg_centos/lv_rootresize2fs 1.41.12 (17-May-2010) Filesystem at/dev/vg_centos/lv_root is mounted on/; on-line resizing requiredold desc_blocks = 1, new_desc_blocks = 1 mongoming an on-line resize of/dev/vg_centos/lv_root to 3523584 (4 k) blocks. the filesystem on/dev/vg_centos/lv_root is now 3523584 blocks long. 7: view the final disk status [root @ CentOS ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/vg_centos-lv_root 14G 5.0G 7.7G 40%/tmpfs 499 M 320 K 498 M 1%/dev/shm/dev/ sda1 485 M 56 M 404 M 13%/boottmpfs 499 M 0 499 M 0%/tmp/ram
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.