LVM2安装使用实操命令过程
相信很多文章写过关于lvm的安装和详细资料,以下为过往记录实际操作的步骤
LVM2安装
直接yum安装:
yum install lvm2
fdisk -l
查看物理卷的情况
df -h查看系统盘情况
初始化xvdf分区,创建pv(物理卷)
[root@ip-xxx-xxx-xxx-xxx usr]# pvcreate /dev/xvdf
Physical volume "/dev/xvdf" successfully created
[root@ip-xxx-xxx-xxx-xxx usr]#
查看物理卷pv信息
[root@ip-xxx-xxx-xxx-xxx usr]# pvdisplay
"/dev/xvdf" is a new physical volume of "500.00 GiB"
--- NEW Physical volume ---
PV Name /dev/xvdf
VG Name
PV Size 500.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID kkRq1o-gnd7-seJx-x19L-Kzn5-K7jf-XkIfmc
创建逻辑卷组vg,将/dev/sdb物理卷加入到这个卷组里
//创建逻辑卷组
[root@ip-xxx-xxx-xxx-xxx ~]# vgcreate DataGroup00 /dev/xvdb2
Volume group "DataGroup00" successfully created
//查看逻辑卷
vgdisplay
创建逻辑卷Data,名称Data00,由卷组DataGroup00提供空间,并给他指定拥有2Tib的空间
//创建逻辑卷
[root@ip-xxx-xxx-xxx-xxx ~]# lvcreate -L 1.99TiB -n Data00 DataGroup00
Rounding up size to full physical extent 1.99 TiB
Logical volume "Data00" created.
[root@ip-xxx-xxx-xxx-xxx ~]# lvdisplay
--- Logical volume ---
LV Path /dev/bigdata/bigdatavolumn
LV Name bigdatavolumn
VG Name bigdata
LV UUID eCegaT-dPfn-VBLN-obYh-llbK-fdA5-p1zGnU
LV Write Access read/write
LV Creation host, time ip-xxx-xxx-xxx-xxx, 2017-06-13 09:04:11 +0000
LV Status available
# open 1
LV Size 499.99 GiB
Current LE 127998
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/DataGroup00/Data00
LV Name Data00
VG Name DataGroup00
LV UUID inCtpk-GxuQ-EzC2-d2w4-simE-rRzT-rdDokz
LV Write Access read/write
LV Creation host, time ip-10-30-2-123, 2017-06-15 06:22:47 +0000
LV Status available
# open 0
LV Size 1.99 TiB
Current LE 521667
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
如何格式化磁盘
mkfs.ext4 /dev/mapper/VolGroup00-LogVol00
mkfs -t ext4 -c /dev/xvdb1
挂载
mount /dev/mapper/bigdata-bigdatavolumn /usr/local/
长期固定挂载
vi /etc/fstab
/dev/mapper/bigdata-bigdatavolumn /usr/local/ ext4 defaults 0 0
- 点赞
- 收藏
- 关注作者
评论(0)