Bootstrap

Linux系统——逻辑卷扩容

Linux系统——逻辑卷扩容

1、对新的磁盘进行分区

[root@ ~]# fdisk /dev/sdc
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 		 #输入n,新建分区
Command action
   e   extended
   p   primary partition (1-4)  	p 		  #输入p,确定主分区
Partition number (1-4): 1					  #输入数字1,选择sdc1
First cylinder (1-652, default 1): 		      #输入回车,默认
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): 	 #输入回车,默认

Command (m for help): t						 #输入t,更改分区的系统id
Selected partition 1
Hex code (type L to list codes): 8e			 #输入8e,选择Linux LVM
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p                      #输入p,打印分区信息

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x00093fc1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         132     1060258+  8e  Linux LVM

Command (m for help): w			#输入w,写入分区 
The partition table has been altered!

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

2、创建物理卷

[root@ ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created

3、把/dev/sdc1添加到已有的vg_data卷组中

[root@ ~]# vgextend vg_data /dev/sdc1
  Physical volume "/dev/sdc1" successfully created
  Volume group "vg_data" successfully extended

检查pv和vg的情况

[root@ ~]# pvs
[root@ ~]# vgs
[root@ ~]# pvdisplay
[root@ ~]# vgdisplay

4、把新增的空间全部加入到已有卷组

[root@ ~]# lvextend -l +100%FREE /dev/mapper/vg_data-lv_data

5、重新加载分区

[root@ ~]# resize2fs /dev/mapper/vg_data-lv_data

6、查看分区大小

[root@ ~]# df –h
;