1. 程式人生 > 實用技巧 >1、建立LV 卷

1、建立LV 卷

環境說明:

虛擬機器軟體:vmware15

系統:centos7.1 最小化安裝

==============================================================

1、更新lvm2包

yum install lvm2
View Code

2、建立物理卷

[root@localhost ~]# pvcreate /dev/sdb /dev/sdc
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
[root@localhost 
~]#
View Code

3、建立卷組

[root@localhost ~]# vgcreate vg_name /dev/sdb /dev/sdc 
  Volume group "vg_name" successfully created
[root@localhost ~]# 
View Code

4、建立邏輯卷

[root@localhost ~]# lvcreate -n lv_1 -L 11G vg_name  #lv_1 是邏輯卷的名稱  , -L 11G 是指定邏輯卷的大小為11G , vg_name 是卷組的名字
  Logical volume "lv_1" created.
[root@localhost 
~]#
View Code

5、格式化邏輯卷

[root@localhost ~]# mkfs.xfs /dev/vg_name/lv_1 
meta-data=/dev/vg_name/lv_1      isize=256    agcount=4, agsize=720896 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096
blocks=2883584, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@localhost ~]#
View Code

6、建立掛載點並掛載邏輯卷

[root@localhost ~]# mkdir /mnt/lv_1
[root@localhost ~]# mount /dev/vg_name/lv_1 /mnt/lv_1/
[root@localhost ~]# 
View Code

7、將磁碟資訊寫入/etc/fstab檔案中,使其永久生效

[root@localhost ~]# echo "/dev/vg_name/lv_1 /mnt/lv_1 xfs defaults 0 0" >> /etc/fstab
View Code