热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux逻辑卷的创建与扩容

Logicalvolume的创建

Logical volume 的创建

Linux逻辑卷的创建与扩容 - 文章图片



  • 磁盘初始化



[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.

Linux逻辑卷的创建与扩容 - 文章图片



  • 物理卷,卷组 创建


[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 ]

Linux逻辑卷的创建与扩容 - 文章图片

> * 逻辑卷创建

[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@skong-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

Linux逻辑卷的创建与扩容 - 文章图片



  • 挂载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 " alt="Linux逻辑卷的创建与扩容 - 文章图片" />

Logical volume 扩容


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



lvdisplay
lvextend /dev/centos/data /dev/sda3
xfs_growfs /dev/centos/data

Linux逻辑卷的创建与扩容 - 文章图片


推荐阅读
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • Go Cobra命令行工具入门教程
    本文介绍了Go语言实现的命令行工具Cobra的基本概念、安装方法和入门实践。Cobra被广泛应用于各种项目中,如Kubernetes、Hugo和Github CLI等。通过使用Cobra,我们可以快速创建命令行工具,适用于写测试脚本和各种服务的Admin CLI。文章还通过一个简单的demo演示了Cobra的使用方法。 ... [详细]
  • 在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板
    本文介绍了在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板的方法和步骤,包括将ResourceDictionary添加到页面中以及在ResourceDictionary中实现模板的构建。通过本文的阅读,读者可以了解到在Xamarin XAML语言中构建控件模板的具体操作步骤和语法形式。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 解决.net项目中未注册“microsoft.ACE.oledb.12.0”提供程序的方法
    在开发.net项目中,通过microsoft.ACE.oledb读取excel文件信息时,报错“未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序”。本文提供了解决这个问题的方法,包括错误描述和代码示例。通过注册提供程序和修改连接字符串,可以成功读取excel文件信息。 ... [详细]
  • Postgresql备份和恢复的方法及命令行操作步骤
    本文介绍了使用Postgresql进行备份和恢复的方法及命令行操作步骤。通过使用pg_dump命令进行备份,pg_restore命令进行恢复,并设置-h localhost选项,可以完成数据的备份和恢复操作。此外,本文还提供了参考链接以获取更多详细信息。 ... [详细]
  • Gitlab接入公司内部单点登录的安装和配置教程
    本文介绍了如何将公司内部的Gitlab系统接入单点登录服务,并提供了安装和配置的详细教程。通过使用oauth2协议,将原有的各子系统的独立登录统一迁移至单点登录。文章包括Gitlab的安装环境、版本号、编辑配置文件的步骤,并解决了在迁移过程中可能遇到的问题。 ... [详细]
  • 使用C++编写程序实现增加或删除桌面的右键列表项
    本文介绍了使用C++编写程序实现增加或删除桌面的右键列表项的方法。首先通过操作注册表来实现增加或删除右键列表项的目的,然后使用管理注册表的函数来编写程序。文章详细介绍了使用的五种函数:RegCreateKey、RegSetValueEx、RegOpenKeyEx、RegDeleteKey和RegCloseKey,并给出了增加一项的函数写法。通过本文的方法,可以方便地自定义桌面的右键列表项。 ... [详细]
  • 本文介绍了如何使用n3-charts绘制以日期为x轴的数据,并提供了相应的代码示例。通过设置x轴的类型为日期,可以实现对日期数据的正确显示和处理。同时,还介绍了如何设置y轴的类型和其他相关参数。通过本文的学习,读者可以掌握使用n3-charts绘制日期数据的方法。 ... [详细]
  • OpenMap教程4 – 图层概述
    本文介绍了OpenMap教程4中关于地图图层的内容,包括将ShapeLayer添加到MapBean中的方法,OpenMap支持的图层类型以及使用BufferedLayer创建图像的MapBean。此外,还介绍了Layer背景标志的作用和OMGraphicHandlerLayer的基础层类。 ... [详细]
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • 推荐系统遇上深度学习(十七)详解推荐系统中的常用评测指标
    原创:石晓文小小挖掘机2018-06-18笔者是一个痴迷于挖掘数据中的价值的学习人,希望在平日的工作学习中,挖掘数据的价值, ... [详细]
  • 本文介绍了解决二叉树层序创建问题的方法。通过使用队列结构体和二叉树结构体,实现了入队和出队操作,并提供了判断队列是否为空的函数。详细介绍了解决该问题的步骤和流程。 ... [详细]
  • 本文详细介绍了MySQL表分区的创建、增加和删除方法,包括查看分区数据量和全库数据量的方法。欢迎大家阅读并给予点评。 ... [详细]
author-avatar
大Joob
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有