Requirements: The virtual machine needs to expand the hard disk capacity, through the Vcenter Edit resource settings, the original 50G expansion to 100G. But not immediately. The following actions are available:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/83/B1/wKioL1d6mWuCIUL8AAA4Dt_3u9w879.png "title=" Qq20160705011341.png "alt=" Wkiol1d6mwuciul8aaa4dt_3u9w879.png "/>
After the modified 100G, log in to the virtual machine to view the following:
[Email protected]_test etc]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/rootvg-lv_root
45G 7.0G 36G 17%/
Tmpfs 3.9G 88K 3.9G 1%/DEV/SHM
/DEV/SDA1 485M 37M 423M 8%/boot
[Email protected]_test ~]# fdisk-l
disk/dev/sda:107.4 GB, 107374182400 bytes
255 heads, Sectors/track, 13054 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000b6327
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 6528 51915776 8e Linux LVM
disk/dev/mapper/rootvg-lv_root:49.0 GB, 48997859328 bytes
255 heads, Sectors/track, 5956 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/mapper/rootvg-lv_swap:4160 MB, 4160749568 bytes
255 heads, Sectors/track, 505 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
1. The operation steps are as follows:
Fdisk-l//view partition list
FDISK/DEV/SDA//partition, divide the Extend partition first, then divide the logical partition. This example is zoned Extand:/dev/sda3, logical partition/DEV/SDA5
M->n, E-W
Fdisk/dev/sda
M->n-L-W
Partx-a/DEV/SDA//Add the specified partition or read the disk and add all partitions
PVCREATE/DEV/SDA5//Initialize partition
Vgextend ROOTVG/DEV/SDA5//Add the initialized partition to the virtual volume Group ROOTVG (Vgdisplay view)
Lvextend-l +100%free/dev/mapper/rootvg-lv_root//Online expansion of disk space, expansion of/dev/mapper/rootvg-lv_root volume space.
Resize2fs/dev/mapper/rootvg-lv_root//Reset size, expansion/dev/mapper/rootvg-lv_root.
Examples of specific operations are as follows:
[[email protected]_test ~]# fdisk -ldisk /dev/sda: 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: 0x000b6327 device boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 linuxpartition 1 does not end on cylinder boundary./dev/sda2 64 6528 51915776 8e linux lvmdisk /dev/mapper/rootvg-lv_root: 49.0 gb, 48997859328 bytes255 heads, 63 sectors/track, 5956 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/rootvg-lv_swap: 4160 mb, 4160749568 bytes255 heads, 63 sectors/track, 505 cylindersunits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesi/o size (minimum/optimal): 512 bytes / 512 bytesdisk identifier: 0x00000000
1) Partitioning
[Email protected]_test etc]# FDISK/DEV/SDA
Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').
Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
E
Partition number (1-4): 3
First cylinder (6528-13054, default 6528):
Using Default Value 6528
Last cylinder, +cylinders or +size{k,m,g} (6528-13054, default 13054):
Using Default Value 13054
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:device or resource busy.
The kernel still uses the old table. The new table is being used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks.
[Email protected]_test etc]# FDISK/DEV/SDA
Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').
Command (M for help): N
Command Action
L logical (5 or over)
P primary partition (1-4)
L
First cylinder (6528-13054, default 6528):
Using Default Value 6528
Last cylinder, +cylinders or +size{k,m,g} (6528-13054, default 13054):
Using Default Value 13054
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:device or resource busy.
The kernel still uses the old table. The new table is being used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks.
Partition completion:
[Email protected]_test etc]# fdisk-l
disk/dev/sda:107.4 GB, 107374182400 bytes
255 heads, Sectors/track, 13054 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000b6327
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 6528 51915776 8e Linux LVM
/dev/sda3 6528 13054 52427455 5 Extended
/dev/sda5 6528 13054 52427423+-up Linux
disk/dev/mapper/rootvg-lv_root:49.0 GB, 48997859328 bytes
255 heads, Sectors/track, 5956 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/mapper/rootvg-lv_swap:4160 MB, 4160749568 bytes
255 heads, Sectors/track, 505 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
2) Initialize/DEV/SDA5, have the following error prompt, Partx-a/dev/sda, initialize again, OK.
[Email protected]_test etc]# Pvcreate/dev/sda5
Device/dev/sda5 not found (or ignored by filtering).
[Email protected]_test etc]# partx-a/DEV/SDA
Blkpg:device or resource busy
Error adding partition 1
Blkpg:device or resource busy
Error adding partition 2
Blkpg:device or resource busy
Error adding partition 3
[Email protected]_test etc]# Pvcreate/dev/sda5
Writing physical volume data to disk "/dev/sda5"
Physical volume "/DEV/SDA5" successfully created
View VG
[Email protected]_test etc]# vgdisply
---Volume Group---
VG Name ROOTVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
ACT PV 1
VG Size 49.51 GiB
PE Size 4.00 MiB
Total PE 12674
Alloc pe/size 12674/49.51 GiB
Free Pe/size 0/0
VG UUID 0N5RVO-5UOB-YYM7-HGNP-PG0X-2RPH-AKJPXF
3) Add/dev/sda5 to the Vggroup volume group: ROOTVG.
[Email protected]_test etc]# vgextend Rootvg/dev/sda5
Volume Group "ROOTVG" successfully extended
4) Online expansion of disk space, expansion/dev/mapper/rootvg-lv_root volume space.
[Email protected]_test etc]# lvextend-l +100%free/dev/mapper/rootvg-lv_root
Extending logical Volume Lv_root to 95.63 GiB
Logical Volume Lv_root successfully resized
[Email protected]_test etc]# Pvdisplay
---physical volume---
PV Name/dev/sda2
VG Name ROOTVG
PV Size 49.51 gib/not usable 3.00 MiB
Allocatable Yes (but full)
PE Size 4.00 MiB
Total PE 12674
Free PE 0
Allocated PE 12674
PV UUID UIP0KZ-A3XO-4X0V-P78O-T1E6-ABUC-F0QQR7
---physical volume---
PV Name/dev/sda5
VG Name ROOTVG
PV Size 50.00 gib/not usable 2.66 MiB
Allocatable Yes (but full)
PE Size 4.00 MiB
Total PE 12799
Free PE 0
Allocated PE 12799
PV UUID JIJY54-GSER-NVPU-FEZV-ZVMI-8CRP-M5AFHP
No reset size,
[Email protected]_test etc]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/rootvg-lv_root
45G 7.0G 36G 17%/
Tmpfs 3.9G 88K 3.9G 1%/DEV/SHM
/DEV/SDA1 485M 37M 423M 8%/boot
5) Reset Volume size
[Email protected]_test etc]# resize2fs/dev/mapper/rootvg-lv_root
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem at/dev/mapper/rootvg-lv_root is mounted on/; On-line resizing required
Old desc_blocks = 3, new_desc_blocks = 6
Performing an on-line resize of/dev/mapper/rootvg-lv_root to 25068544 (4k) blocks.
The filesystem on/dev/mapper/rootvg-lv_root is now 25068544 blocks long.
view again, has been expanded successfully
[Email protected]_test etc]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/rootvg-lv_root
95G 7.0G 83G 8%/
Tmpfs 3.9G 88K 3.9G 1%/DEV/SHM
/DEV/SDA1 485M 37M 423M 8%/boot
[Email protected]_test ~]# fdisk-l
disk/dev/sda:107.4 GB, 107374182400 bytes
255 heads, Sectors/track, 13054 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000b6327
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 6528 51915776 8e Linux LVM
/dev/sda3 6528 13054 52427455 5 Extended
/dev/sda5 6528 13054 52427423+-up Linux
disk/dev/mapper/rootvg-lv_root:102.7 GB, 102680756224 bytes
255 heads, Sectors/track, 12483 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/mapper/rootvg-lv_swap:4160 MB, 4160749568 bytes
255 heads, Sectors/track, 505 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
[[Email Protected]_test ~]#
This article is from "Love_ Yao" blog, please be sure to keep this source http://20161215.blog.51cto.com/2276215/1795777
Radhat Linux 6.3 partition online expansion