Linux LVM 扩容

安装软件提示存储不足:
[root@localhost ~]# rpm -ivh in**-6478.el5.i386.rpm
Preparing... ########################################### [100%]
installing package in**-6478.el5.i386 needs 49MB on the / filesystem
[root@localhost ~]#

[root@localhost ~]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
18156292 17826096 0 100% /
/dev/sda1 101086 38687 57180 41% /boot
tmpfs 1037460 0 1037460 0% /dev/shm
.host:/ 157287392 134538736 22748656 86% /mnt/hgfs

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM

在虚拟机设置里添加一块硬盘,


[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 2610.
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)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): q
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


再fdisk:
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 5 Extended

创建PV:
[root@localhost ~]# pvcreate /dev/sdb1
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
[root@localhost ~]#

扩展VolGroup00 :
[root@localhost ~]# vgextend VolGroup00 /dev/sdb1
Volume group "VolGroup00" successfully extended
[root@localhost ~]#

扩展LV:
[root@localhost ~]# lvextend -L 20G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 20.00 GB
Logical volume LogVol00 successfully resized
[root@localhost ~]#

执行重设大小:
[root@localhost ~]# 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 5242880 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 5242880 blocks long.

[root@localhost ~]#

未经允许不得转载:ganlei的个人博客 » Linux LVM 扩容

赞 (0)
分享到:更多 ()