虚拟机有分区的情况下,扩磁盘

来源:互联网 发布:win7固态硬盘优化 编辑:程序博客网 时间:2024/06/05 07:38
--------磁盘有分区的情况下[root@ywcrmdb ~]# fdisk -lDisk /dev/sda: 751.6 GB, 751619276800 bytes255 heads, 63 sectors/track, 91379 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000923d9   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          64      512000   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              64       65271   523774976   8e  Linux LVMDisk /dev/mapper/vg_ywcrmdb-lv_root: 473.1 GB, 473117491200 bytes255 heads, 63 sectors/track, 57519 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_ywcrmdb-lv_root doesn't contain a valid partition tableDisk /dev/mapper/vg_ywcrmdb-lv_swap: 10.6 GB, 10552868864 bytes255 heads, 63 sectors/track, 1282 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_ywcrmdb-lv_swap doesn't contain a valid partition tableDisk /dev/mapper/vg_ywcrmdb-lv_home: 52.7 GB, 52672069632 bytes255 heads, 63 sectors/track, 6403 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_ywcrmdb-lv_home doesn't contain a valid partition table扩展后容量变为751G,需要划分余下未分配的空间fdisk /dev/sdaCommand (m for help): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 3First cylinder (65271-91379, default 65271): Using default value 65271Last cylinder, +cylinders or +size{K,M,G} (65271-91379, default 91379): Using default value 91379Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.重启主机后,多出了sda3[root@ywcrmdb dev]# ls -ltr sd*brw-rw---- 1 root disk 8, 3  4月 28 11:23 sda3brw-rw---- 1 root disk 8, 2  4月 28 11:23 sda2brw-rw---- 1 root disk 8, 1  4月 28 11:23 sda1brw-rw---- 1 root disk 8, 0  4月 28 11:24 sda[root@ywcrmdb dev]# pvcreate /dev/sda3  Writing physical volume data to disk "/dev/sda3"  Physical volume "/dev/sda3" successfully created[root@ywcrmdb dev]# pvdisplay   --- Physical volume ---  PV Name               /dev/sda2  VG Name               vg_ywcrmdb  PV Size               499.51 GiB / not usable 3.00 MiB  Allocatable           yes (but full)  PE Size               4.00 MiB  Total PE              127874  Free PE               0  Allocated PE          127874  PV UUID               qoLfbb-Vsu5-damB-VtNI-Rn3L-PNF5-yvWsEk     "/dev/sda3" is a new physical volume of "200.00 GiB"  --- NEW Physical volume ---  PV Name               /dev/sda3  VG Name                 PV Size               200.00 GiB  Allocatable           NO  PE Size               0     Total PE              0  Free PE               0  Allocated PE          0  PV UUID               P2mUfD-BO2J-Oinz-av6G-Oz1H-UYRD-hGciOE   [root@ywcrmdb dev]# vgextend  vg_ywcrmdb /dev/sda3  Volume group "vg_ywcrmdb" successfully extended[root@ywcrmdb dev]# vgdisplay   --- Volume group ---  VG Name               vg_ywcrmdb  System ID               Format                lvm2  Metadata Areas        2  Metadata Sequence No  5  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                2  Act PV                2  VG Size               699.50 GiB  PE Size               4.00 MiB  Total PE              179073  Alloc PE / Size       127874 / 499.51 GiB  Free  PE / Size       51199 / 200.00 GiB  VG UUID               5FA4n9-p3o6-TeR4-KbwO-Bg6J-NB8Z-JXo9UX[root@ywcrmdb dev]# lvextend -L +100G /dev/mapper/vg_ywcrmdb-lv_root   Extending logical volume lv_root to 540.62 GiB  Logical volume lv_root successfully resized resize2fs /dev/mapper/vg00-lv_root 


0 0