码迷,mamicode.com
首页 > 系统相关 > 详细

Linux逻辑卷创建

时间:2016-09-26 16:21:58      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

1.创建PV物理卷
[root@localhost ~]# pvcreate /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 
  Physical volume “/dev/sda4” successfully created
  Physical volume “/dev/sda5” successfully created
  Physical volume “/dev/sda6” successfully created
  Physical volume “/dev/sda7” successfully created
  
2.创建VG卷组
[root@localhost ~]# vgcreate vg_data /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 
  Volume group “vg_data” successfully created
  
3.查看卷组信息
[root@localhost ~]# vgdisplay 
  — Volume group —
  VG Name               vg_data
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               3.00 TiB
  PE Size               4.00 MiB
  Total PE              787436
  Alloc PE / Size       0 / 0   
  Free  PE / Size       787436 / 3.00 TiB
  VG UUID               Ee9ybc-nWcJ-zQeA-o4VS-o2JK-3m9A-y8BR8r
  
3.按照PE大小创建逻辑卷
lvcreate -l 787436 -n lv_data vg_data

4.格式化逻辑卷
mkfs.ext4 /dev/mapper/vg_data-lv_data  

5.查看逻辑卷UUID
[root@localhost ~]# blkid 
/dev/sda2: UUID=”fc5f54a3-f6c9-49bd-8dd2-a536de2b8370″ TYPE=”ext4″ 
/dev/sda1: SEC_TYPE=”msdos” UUID=”99FB-7635″ TYPE=”vfat” 
/dev/sda3: UUID=”3e5deca5-7b13-4630-83bd-97223a796e2d” TYPE=”swap” 
/dev/sda4: UUID=”iKfv7K-NMgT-y99g-AC8i-uYLb-e3f0-6DdVjL” TYPE=”LVM2_member” 
/dev/sda5: UUID=”68t2lx-NJSS-TeXe-gjIr-GIqw-hBr1-MeAweb” TYPE=”LVM2_member” 
/dev/sda6: UUID=”0lH7h8-NpiS-j2Zw-vZR9-3E2G-0t7K-mAqdLm” TYPE=”LVM2_member” 
/dev/sda7: UUID=”WLafSq-Sznd-tD7S-b8oS-s7sn-pdP1-rxYVdx” TYPE=”LVM2_member” 
/dev/mapper/vg_data-lv_data: UUID=”7d816a72-1797-4746-b48b-594ffa954fe4″ TYPE=”ext4″ 

6.创建挂载目录
mkdir /u01

7.写入/etc/fstab
UUID=7d816a72-1797-4746-b48b-594ffa954fe4  /u01       ext4    defaults     1 2

8.挂载文件系统
mount -a

9.验证结果
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             753G  2.5G  713G   1% /
tmpfs                  32G   72K   32G   1% /dev/shm
/dev/sda1             200M  260K  200M   1% /boot/efi
/dev/mapper/vg_data-lv_data
                      3.0T  200M  2.9T   1% /u01
                      
10.删除逻辑卷(适用于新创建)
[root@localhost ~]# lvremove /dev/mapper/vg_data-lvol0
Do you really want to remove active logical volume lvol0? [y/n]: y
  Logical volume “lvol0” successfully removed

Linux逻辑卷创建

标签:

原文地址:http://www.cnblogs.com/ityunv/p/5909404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!