[root@localhost ~]fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xee9b440c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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)
p
Partition number (1-4): 1
First cylinder (1-5221, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G}(1-5221, default 5221):
Using default value 5221
Command (m for help): w
[root@localhost ~]fdisk -l /dev/sdb
Disk /dev/sdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0xee9b440c
Device Boot Start End Blocks Id System
/dev/sdb1 1 5221 41937651 83 Linux
更改硬盘 ID ,默认为83,lvm为 8e 并重启操作系统:
[root@localhost ~]fdisk /dev/sdb
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): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0xee9b440c
Device Boot Start End Blocks Id System
/dev/sdb1 1 5221 41937651 8e Linux LVM
Command (m for help): w
[root@localhost ~] vgextend VolGroup /dev/sdb1
Volume group "VolGroup" successfully extended
vgdisplay //用于显示LNM卷组的元数据信息。
[root@localhost ~] vgdisplay
--- Volume group ---
VG Name VolGroup
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 59.50 GiB
PE Size 4.00 MiB
Total PE 15232
Alloc PE / Size 4994 / 19.51 GiB
Free PE / Size 10238 / 39.99 GiB
VG UUID PNgbYA-sj6B-apNB-zOku-ax56-031V-RQKitY
[root@localhost ~] resize2fs /dev/mapper/VolGroup-LogVol01
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-LogVol01 is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/mapper/VolGroup-LogVol01 to 15073280 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-LogVol01 is now 15073280 blocks long.