虚拟机LUN扩大后,重新分区

[root@ywcrmdb ~]# fdisk -l


Disk /dev/sda: 751.6 GB, 751619276800 bytes
255 heads, 63 sectors/track, 91379 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000923d9


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       65271   523774976   8e  Linux LVM


Disk /dev/mapper/vg_ywcrmdb-lv_root: 473.1 GB, 473117491200 bytes
255 heads, 63 sectors/track, 57519 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_ywcrmdb-lv_root doesn't contain a valid partition table


Disk /dev/mapper/vg_ywcrmdb-lv_swap: 10.6 GB, 10552868864 bytes
255 heads, 63 sectors/track, 1282 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_ywcrmdb-lv_swap doesn't contain a valid partition table


Disk /dev/mapper/vg_ywcrmdb-lv_home: 52.7 GB, 52672069632 bytes
255 heads, 63 sectors/track, 6403 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_ywcrmdb-lv_home doesn't contain a valid partition table


扩展后容量变为751G,需要划分余下未分配的空间
fdisk /dev/sda
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (65271-91379, default 65271): 
Using default value 65271
Last cylinder, +cylinders or +size{K,M,G} (65271-91379, default 91379): 
Using default value 91379


Command (m for help): w
The 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 at
the 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 sda3
brw-rw---- 1 root disk 8, 2  4月 28 11:23 sda2
brw-rw---- 1 root disk 8, 1  4月 28 11:23 sda1
brw-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



你可能感兴趣的:(虚拟机)