[root@localhost ~]# ls /dev/vda*
/dev/vda /dev/vda1 /dev/vda2 /dev/vda3 /dev/vda5
[root@localhost ~]# fdisk -l
Disk /dev/vda: 171.8 GB, 171798691840 bytes
16 heads, 63 sectors/track, 332881 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002a6a8
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 10403 4729856 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 10403 20805 5242840 5 Extended
/dev/vda5 10403 20805 5242808+ 8e Linux LVM
[root@localhost ~]# fdisk /dev/vda
创建新分区,如果没有扩展分区,可以创建扩展分区在创建逻辑分区后加入卷,如果已创建扩展分区,只能创建主分区,但不推荐创建主分区。
[root@localhost ~]# fdisk /dev/vda
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)
p
Selected partition 4
First cylinder (1-332881, default 1): 20806
Last cylinder, +cylinders or +size{K,M,G} (20806-332881, default 332881):
Using default value 332881
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 will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]# sync
[root@localhost dev]# reboot
[root@localhost dev]# fdisk -l
Disk /dev/vda: 171.8 GB, 171798691840 bytes
16 heads, 63 sectors/track, 332881 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002a6a8
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 10403 4729856 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 10403 20805 5242840 5 Extended
/dev/vda4 20806 332881 157286304 83 Linux
/dev/vda5 10403 20805 5242808+ 8e Linux LVM
[root@localhost dev]# pvcreate vda4
Physical volume “vda4” successfully created
[root@localhost dev]# vgex
vgexport vgextend
[root@localhost dev]# vgextend VolGroup vda4
Volume group “VolGroup” successfully extended
[root@localhost dev]# vgdisplay
— Volume group —
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 16
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size 159.50 GiB
PE Size 4.00 MiB
Total PE 40832
Alloc PE / Size 2433 / 9.50 GiB
Free PE / Size 38399 / 150.00 GiB
VG UUID Kvvpn6-3i04-e0RY-YRb5-0KHm-wUup-E8HzUr
[root@localhost dev]# lvextend -l+38399 /dev/VolGroup/lv_root
Extending logical volume lv_root to 157.53 GiB
Logical volume lv_root successfully resized
[root@localhost dev]# resize2fs VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 10
Performing an on-line resize of VolGroup/lv_root to 41295872 (4k) blocks.
The filesystem on VolGroup/lv_root is now 41295872 blocks long.
[root@localhost dev]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
156G 1.8G 146G 2% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/vda1 485M 37M 423M 8% /boot