您的位置:首页 > 运维架构 > Linux

centos5.4 lvm分区扩展硬盘

2010-05-10 15:15 861 查看
[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

5.7G 1.8G 3.7G 32% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 252M 0 252M 0% /dev/shm

[root@localhost ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 1044 8281507+ 8e Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

[root@localhost ~]# 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.

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-261, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):

Using default value 261

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): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

5.7G 1.8G 3.7G 32% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 252M 0 252M 0% /dev/shm

[root@localhost ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 1044 8281507+ 8e Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 261 2096451 8e Linux LVM

[root@localhost ~]# pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created

[root@localhost ~]# vgdisplay

/dev/hdc: open failed: 找不到介质

--- 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 7.88 GB

PE Size 32.00 MB

Total PE 252

Alloc PE / Size 252 / 7.88 GB

Free PE / Size 0 / 0

VG UUID Fq9Gxs-9zS7-f0Y3-dhNB-Haqr-rH8d-lJqD84

[root@localhost ~]# vgextend VolGroup00 /dev/sdb1

/dev/hdc: open failed: 找不到介质

Volume group "VolGroup00" successfully extended

[root@localhost ~]# vgdisplay

--- 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 9.84 GB

PE Size 32.00 MB

Total PE 315

Alloc PE / Size 252 / 7.88 GB

Free PE / Size 63 / 1.97 GB

VG UUID Fq9Gxs-9zS7-f0Y3-dhNB-Haqr-rH8d-lJqD84

[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

5.7G 1.8G 3.7G 32% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 252M 0 252M 0% /dev/shm

[root@localhost ~]# lvresize -L +1.97G /dev//VolGroup00/LogVol00

Rounding up size to full physical extent 2.00 GB

Extending logical volume LogVol00 to 7.88 GB

Insufficient free space: 64 extents needed, but only 63 available

[root@localhost ~]# lvresize -L +1.96G /dev//VolGroup00/LogVol00

Rounding up size to full physical extent 1.97 GB

Extending logical volume LogVol00 to 7.84 GB

Logical volume LogVol00 successfully resized

[root@localhost ~]# vgdisplay

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 2

Metadata Sequence No 5

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 9.84 GB

PE Size 32.00 MB

Total PE 315

Alloc PE / Size 315 / 9.84 GB

Free PE / Size 0 / 0

VG UUID Fq9Gxs-9zS7-f0Y3-dhNB-Haqr-rH8d-lJqD84

[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

5.7G 1.8G 3.7G 32% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 252M 0 252M 0% /dev/shm

[root@localhost ~]# resize2fs /dev/mapper/VolGroup00-LogVol00

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required

Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 2056192 (4k) blocks.

The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 2056192 blocks long.

[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/VolGroup00-LogVol00

7.6G 1.8G 5.5G 24% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 252M 0 252M 0% /dev/shm

[root@localhost ~]# reboot

Broadcast message from root (pts/0) (Mon May 10 22:45:52 2010):

The system is going down for reboot NOW!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  硬盘 分区 休闲 centos lvm