作者:llk726 原始连接: http://llk726.blog.51cto.com/622293/166536
公司的FTP服务器经过几年的运行,现在出现了空间不足的情况,决定用LVM方式实现扩容工作。
思路:先拷贝数据,再购置一块大容量硬盘添加到服务器上,然后将己有的普通分区转换为物理卷,最后通过物理卷创建逻辑卷组来实现容量的扩充。
实现过程:
A、检查系统中是否安装了LVM工具,如果没有安装就下载安装。
[root@linuxas ~]# rpm -qa | grep lvm
system-config-lvm-1.0.22-1.0.el5
lvm2-2.02.16-3.el5
B、 创建和管理LVM
1、创建或转换分区
[root@linuxas ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 1044.
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): p(查看分区情况)
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 25 200781 83 Linux
/dev/sda2 26 535 4096575 83 Linux
/dev/sda3 536 854 2562367+ 83 Linux
/dev/sda4 855 1044 1526175 5 Extended
/dev/sda5 855 905 409626 82 Linux swap / Solaris
/dev/sda6 906 1044 1116486 83 Linux
Command (m for help): t (更改分区类型)
Partition number (1-6): 6 (将第6个分区转换成LVM)
Hex code (type L to list codes): 8e(将分区类型指定为“8e”就是LVM)
Changed system type of partition 6 to 8e (Linux LVM)
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: 璁惧鎴栬祫婧愬繖.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.