Logical volume 的创建

磁盘初始化

[root@xxxx-centos7-template ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000a580e

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 411647 204800 83 Linux

/dev/sda2 411648 104857599 52222976 8e Linux LVM

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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 /dev/mapper/centos-root: 44.9 GB, 44883247104 bytes, 87662592 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 /dev/mapper/centos-swap: 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

[root@xxxx-centos7-template ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 42G 1.6G 41G 4% /

devtmpfs 3.9G 0 3.9G 0% /dev

tmpfs 3.9G 0 3.9G 0% /dev/shm

tmpfs 3.9G 8.5M 3.9G 1% /run

tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup

/dev/sda1 197M 103M 95M 53% /boot

tmpfs 799M 0 799M 0% /run/user/0

[root@xxxx-centos7-template ~]# mkdir /data

[root@xxxx-centos7-template ~]# 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 0x3bb4b474.

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-209715199, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):

Using default value 209715199

Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): p

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0x3bb4b474

Device Boot Start End Blocks Id System

/dev/sdb1 2048 209715199 104856576 83 Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@xxxx-centos7-template ~]# partprobe

Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.

物理卷,卷组 创建

[root@xxxxcentos7-template ~]# pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created.

[root@xxxx-centos7-template ~]# vgdisplay

--- Volume group ---

VG Name centos

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 49.80 GiB

PE Size 4.00 MiB

Total PE 12749

Alloc PE / Size 12749 / 49.80 GiB

Free PE / Size 0 / 0

VG UUID uYlfgy-kh0D-YE6a-A3Eq-n4RN-t3QF-C7HBLS

[root@xxxx-centos7-template ~]# vgextend centos /dev/sdb1

Volume group "centos" successfully extended

[root@xxxx-centos7-template ~]# pvscan

PV /dev/sda2 VG centos lvm2 [49.80 GiB / 0 free]

PV /dev/sdb1 VG centos lvm2 [<100.00 GiB / <100.00 GiB free]

Total: 2 [<149.80 GiB] / in use: 2 [<149.80 GiB] / in no VG: 0 [0 ]

> * 逻辑卷创建

[root@xxxx-centos7-template ~]# lvdisplay

--- Logical volume ---

LV Path /dev/centos/swap

LV Name swap

VG Name centos

LV UUID vFM0SF-6giK-lWPg-iCTY-usKM-ywpA-bp5zxd

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

open 2

LV Size 8.00 GiB

Current LE 2048

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:1

--- Logical volume ---

LV Path /dev/centos/root

LV Name root

VG Name centos

LV UUID mtRvdH-eFlc-3EiS-xQbW-lqfm-y6K5-bAiZrv

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

open 1

LV Size 41.80 GiB

Current LE 10701

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:0

[root@xxxx-centos7-template ~]# lvcreate -L 100G -n data centos

Volume group "centos" has insufficient free space (25599 extents): 25600 required.

[root@xxxx-centos7-template ~]# lvdisplay

--- Logical volume ---

LV Path /dev/centos/swap

LV Name swap

VG Name centos

LV UUID vFM0SF-6giK-lWPg-iCTY-usKM-ywpA-bp5zxd

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

# open 2

LV Size 8.00 GiB

Current LE 2048

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:1

--- Logical volume ---

LV Path /dev/centos/root

LV Name root

VG Name centos

LV UUID mtRvdH-eFlc-3EiS-xQbW-lqfm-y6K5-bAiZrv

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

open 1

LV Size 41.80 GiB

Current LE 10701

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:0

[root@xxxx-centos7-template ~]# lvcreate -L 99G -n data centos

Logical volume "data" created.

[root@xxxx-centos7-template ~]# lvdisplay

--- Logical volume ---

LV Path /dev/centos/swap

LV Name swap

VG Name centos

LV UUID vFM0SF-6giK-lWPg-iCTY-usKM-ywpA-bp5zxd

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

open 2

LV Size 8.00 GiB

Current LE 2048

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:1

--- Logical volume ---

LV Path /dev/centos/root

LV Name root

VG Name centos

LV UUID mtRvdH-eFlc-3EiS-xQbW-lqfm-y6K5-bAiZrv

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2018-04-20 13:44:01 +0800

LV Status available

open 1

LV Size 41.80 GiB

Current LE 10701

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:0

--- Logical volume ---

LV Path /dev/centos/data

LV Name data

VG Name centos

LV UUID Jj7pYx-vlUm-2z9U-UcK0-Wx3m-182t-UeQH25

LV Write Access read/write

LV Creation host, time xxxx-centos7-template, 2019-03-13 20:50:49 +0800

LV Status available

open 0

LV Size 99.00 GiB

Current LE 25344

Segments 1

Allocation inherit

Read ahead sectors auto

* currently set to 8192

Block device 253:2

> * 挂载lvm

[root@xxxx-centos7-template ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 42G 1.6G 41G 4% /

devtmpfs 3.9G 0 3.9G 0% /dev

tmpfs 3.9G 0 3.9G 0% /dev/shm

tmpfs 3.9G 8.5M 3.9G 1% /run

tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup

/dev/sda1 197M 103M 95M 53% /boot

tmpfs 799M 0 799M 0% /run/user/0

[root@xxxx-centos7-template ~]# mkfs.ext4 -j /dev/centos/data

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

6488064 inodes, 25952256 blocks

1297612 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2174746624

792 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

[root@xxxx-centos7-template ~]# vim /etc/fstab

[root@xxxx-centos7-template ~]# cat /etc/fstab

/dev/mapper/centos-root / xfs defaults 0 0

UUID=30d431c7-640e-4431-8850-4a686d553114 /boot xfs defaults 0 0

/dev/mapper/centos-swap swap swap defaults 0 0

/dev/centos/data /data ext4 defaults 0 0

[root@xxxx-centos7-template ~]#

[root@xxxx-centos7-template ~]# mount -a

[root@xxxx-centos7-template ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 42G 1.6G 41G 4% /

devtmpfs 3.9G 0 3.9G 0% /dev

tmpfs 3.9G 0 3.9G 0% /dev/shm

tmpfs 3.9G 8.5M 3.9G 1% /run

tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup

/dev/sda1 197M 103M 95M 53% /boot

tmpfs 799M 0 799M 0% /run/user/0

/dev/mapper/centos-data 98G 61M 93G 1% /data

Logical volume 扩容

如果单纯的给已存在了逻辑卷扩容

fdisk -l

fdisk /dev/sdb

partprobe

fdisk -l

lvdisplay

pvcreate /dev/sdb1

vgdisplay

vgextend centos /dev/sdb1

pvscan

lvdisplay

lvextend /dev/centos/data /dev/sdb1

[root@silence ~]# df -T

文件系统 类型 1K-块 已用 可用 已用% 挂载点

/dev/mapper/centos-root xfs 52403200 1913936 50489264 4% /

devtmpfs devtmpfs 1964224 0 1964224 0% /dev

tmpfs tmpfs 1976320 0 1976320 0% /dev/shm

tmpfs tmpfs 1976320 11908 1964412 1% /run

tmpfs tmpfs 1976320 0 1976320 0% /sys/fs/cgroup

/dev/sda1 xfs 1038336 135236 903100 14% /boot

/dev/mapper/centos-home xfs 26324420 32992 26291428 1% /home

tmpfs tmpfs 395268 0 395268 0% /run/user/0

xfs_growfs /dev/centos/data ##当逻辑卷文件系统为xfs使用

resize2fs /dev/centos/data ##当逻辑卷文件系统为ext4使用

centos 对已有卷扩容_centos7 逻辑卷扩容相关推荐

  1. Linux-磁盘扩容(逻辑卷方式)

    一.介绍 根目录空间紧张,以不加硬盘的方式扩容根目录空间. 二.实操 (1)磁盘情况-根目录36G [root@xdw0 disk]# df -h 文件系统 容量 已用 可用 已用% 挂载点 devt ...

  2. CentOS 6.3下配置LVM(逻辑卷管理

    CentOS 6.3下配置LVM(逻辑卷管理) 一.简介 LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬 ...

  3. CentOS 6.3下配置LVM(逻辑卷管理)

    CentOS 6.3下配置LVM(逻辑卷管理) 一.简介 LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬 ...

  4. 【Red Hat7创建/扩容/删除逻辑卷 #步骤非常非常详细】

    目录 一.概述 二.创建物理分区 1.创建sdb1  sdc1分区  ,并把分区类型设置为Linux LVM 2.partprobe           #partprobe  内核重新读取sdb分区 ...

  5. linux系统中的分区与挂载,以及使用LVM逻辑卷管理器管理物理卷,卷组,逻辑卷知识点总结

    物理设备的命名规则 在Linux系统中一切都是文件,硬件设备也不例外.既然是文件,就必须有文件名称.系统内核中的udev设备管理器会自动把硬件名称规范起来,目的是让用户通过设备文件的名字可以猜出设备大 ...

  6. 物理卷,卷组,逻辑卷

    物理卷 什么是物理卷 把一个硬盘添加到某卷组前,必须在系统中将其配置为物理卷(PV),分配一个唯一的物理卷标识符和物理卷名,同时使它处于可用状态.PV上保存着有关该PV的某些配置和表示信息,如PV的标 ...

  7. linux修改卷组pe大小,在Linux如何扩增卷组、逻辑卷以及缩减逻辑卷LVM的过程

    今天我们将了解怎样来扩展卷组,扩展和缩减逻辑卷.在这里,我们可以缩减或者扩展逻辑卷管理(lvm)中的分区,lvm也可称之为弹性卷文件系统. 前置需求使用lvm创建弹性磁盘存储--第一部分 什么时候我们 ...

  8. Linux 物理卷(PV)、逻辑卷(LV)、卷组(VG)管理

    (一)相关概念 逻辑卷是使用逻辑卷组管理(Logic Volume Manager)创建出来的设备,如果要了解逻辑卷,那么首先需要了解逻辑卷管理中的一些概念. 物理卷(Physical Volume, ...

  9. linux查看lv逻辑卷信息,Linux学习笔记(lvm pv物理卷—VG卷组—LV逻辑卷)

    一.LVM 准备磁盘分区 disk /dev/sdb n创建分区 t更改类型 8e partprobe 将磁盘分区表变化信息通知内核,请求操作系统重新加载分区表.-d 不更新内核 -s 显示磁盘分区汇 ...

最新文章

  1. 一個简单的okhttp访问网络的例子
  2. 单例设计模式-饿汉式
  3. 学习多媒体开发的正确姿势?陈功:看书 啃代码 搞插件
  4. LATEX调整公式、图片与正文间距离,文字间距离,调整空白大小
  5. c/c++这么难学,那么学会了究竟有多牛X呢?
  6. DataGrid添加CheckBox(下拉列表)
  7. 不同VPC路由器通过静态路由、动态路由(OSPF)实现网络互通实战
  8. 好用的安卓手机投屏电脑软件
  9. Unity 获取视频缩略图
  10. 计算机R3处理器,2018年3月最新版处理器天梯图 秒懂三月台式电脑处理器性能排行...
  11. php 如何使用ck播放视频,[原创]简单代码利用ckplayer播放器实现帝国CMS播放优酷在线视频...
  12. 基于java+springboot+mybatis+vue+elementui的农机机械设备租赁平台
  13. 常用的CSS属性列表汇总
  14. 前端用 js-file-download组件 下载后端返回的Excel文件
  15. 围城如社会,故事如生活
  16. 500. Keyboard Row
  17. Cyclen-PEG-Bodipy;大环配体-聚乙二醇-氟化硼二吡咯;大环配体-PEG-Bodipy
  18. Word格式处理控件Aspose.Words for .NET水印处理教程——如何添加和删除水印
  19. linux convert 常用命令
  20. Java之父求职被嫌年纪大:程序员只能吃青春饭?

热门文章

  1. leetcode 208. Implement Trie (Prefix Tree) | 208. 实现 Trie 前缀树(Java)
  2. 数据结构:利用栈,将递归转换为非递归的方法
  3. 在java程序中使用protobuf
  4. 三种方式实现分布式锁
  5. Spring事务管理--嵌套事务详解
  6. 程序图形化界面刷新以及如何从tkinter窗口中正确读出数据
  7. 扩展内容(线程的同步方法)
  8. 1034 Head of a Gang (30 分) One way that the police finds the head of a gang is to check people‘s pho
  9. 【三种解法】Not so Mobile UVA - 839_19行代码AC
  10. 【测试点分析】1088 三人行 (20分)_29行代码AC