系统环境:RedHat 5.5 64bit
系统情况:采用操作系统默认分区(LV)
事件原由:扩充根分区大小
操作记录:
[root@node1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-6527, default 6527):
Using default value 6527
Command (m for help): p
Disk /dev/sdb: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 6527 52428096 83 Linux
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: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 6527 52428096 8e Linux LVM
Command (m for help): wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@node1 ~]#
[root@node1 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@node1 ~]# partprobe
[root@node1 ~]# vgdisplay
/dev/hdc: open failed: No medium found
--- Volume group ---
VG Name VolGroup00
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 29.88 GB
PE Size 32.00 MB
Total PE 956
Alloc PE / Size 956 / 29.88 GB
Free PE / Size 0 / 0
VG UUID 0W89dj-GEjI-ltiZ-k4Cp-LEYh-FUdc-5fTyde
[root@node1 ~]# vgextend VolGroup00 /dev/sdb1
/dev/hdc: open failed: No medium found
Volume group "VolGroup00" successfully extended
[root@node1 ~]# vgdisplay
/dev/hdc: open failed: No medium found
--- Volume group ---
VG Name VolGroup00
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 79.84 GB
PE Size 32.00 MB
Total PE 2555
Alloc PE / Size 956 / 29.88 GB
Free PE / Size 1599 / 49.97 GB
VG UUID 0W89dj-GEjI-ltiZ-k4Cp-LEYh-FUdc-5fTyde
[root@node1 ~]# lvdisplay
/dev/hdc: open failed: No medium found
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID t58TE3-DbHI-QUUs-Tlle-9gSK-gn9U-YZAJFL
LV Write Access read/write
LV Status available
# open 1
LV Size 20.12 GB
Current LE 644
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID 4C8Tp1-rlhc-0P1E-oCEj-2V1b-Okan-weS2fm
LV Write Access read/write
LV Status available
# open 1
LV Size 9.75 GB
Current LE 312
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@node1 ~]# lvresize -l +1599 /dev/VolGroup00/LogVol00
/dev/hdc: open failed: No medium found
Extending logical volume LogVol00 to 70.09 GB
Logical volume LogVol00 successfully resized
[root@node1 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 18374656 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 18374656 blocks long.
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
68G 14G 51G 22% /
/dev/sda1 99M 16M 78M 17% /boot
tmpfs 3.9G 176M 3.8G 5% /dev/shm
[root@node1 ~]#