下龙山一号楼

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

LVM介绍:

  LVM(Logic Volume Manager)是逻辑卷管理的简称。它是Linux环境下对磁盘分区管理的一种机制。对于其他的的UNIX(AIX/HP/SUM)操作系统,以及Windows系统也有类似的磁盘管理软件。LVM管理的方式非常简单,就是通过将底层的物料磁盘抽象并封装起来,然后以逻辑的方式呈现给上层应用。

LVM的组成与概念:

  PE   physical extend   存储的基本单位,PE默认大小为4M。
  PV  physical volume   物理磁盘被格式化成PV
  VG  volume group   不同的PV加入同一个VG,VG相当于一个磁盘资源池
  LV  logic volume   LV使用VG的磁盘空间,由众多个PE组成,组成LV的PE可能来自不同磁盘,LV的扩充实际上就是增加或者加少PE的数 量,其过程不丢失数据。并且LV可以直接格式化使用。
 
1、 创建分区 使用分区工具(如:fdisk等)创建LVM分区,方法和创建其他一般分区的方式是一样的,区别仅仅是LVM的分区类型为8e
 
[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x13ff78fe.

Command (m for help): n  #创建新的分区
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p    #分区类型是主分区
Partition number (1-4, default 1):
First sector (2048-16777215, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215):
Using default value 16777215
Partition 1 of type Linux and of size 8 GiB is set

Command (m for help): t   #修改分区格式
Selected partition 1
Hex code (type L to list all codes): 8e  #类型是8e (LVM)
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p   #查看当前分区

Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x13ff78fe

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    16777215     8387584   8e  Linux LVM

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

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

 

posted on 2019-09-05 14:21  下龙山王俊凯  阅读(206)  评论(0编辑  收藏  举报