lvm动态扩展硬盘

来源:互联网 发布:鼎力测试软件下载 编辑:程序博客网 时间:2024/05/22 11:16

如果硬盘不通过RAID卡直接接在主板上,可以实现在线扩容;但目前需要增加2块硬盘做RAID1,需要对新RAID组初始化,故需要停机。
采用LVM磁盘管理对系统透明。

检查新增加的硬盘
# fdisk -l

创建物理卷
# pvcreate /dev/sdb

扩展卷组
# vgextend VolGroup00 /dev/sdb

扩展整个硬盘的容量给逻辑卷
# lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00

重新(激活)定义逻辑卷大小
# resize2fs  /dev/VolGroup00/LogVol00

查看是否生效
#df -h

 

[root@store150 ~]# resize2fs  /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
resize2fs: File too large while trying to determine filesystem size


Linux Create 3TB partition size
To create a partition start GNU parted as follows:
# parted /dev/sdb

Creates a new GPT disklabel i.e. partition table:

(parted) mklabel gpt

Next, set the default unit to TB, enter:

(parted) unit TBTo create a 3TB partition size, enter:

(parted) mkpart primary 0 0OR

(parted) mkpart primary 0.00TB 3.00TBTo print the current partitions, enter:

(parted) print


Quit and save the changes, enter:

(parted) quit


Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter:
# mkfs.ext3 /dev/sdb1


# mkdir /data
# mount /dev/sdb1 /data
# df -H

 


[root@store150 ~]# mkdir /data2
[root@store150 ~]# mount /dev/sdc /data2
[root@store150 ~]# mkfs.ext3 /dev/sdc