LVM的工作方式      

LVM管理工具集

[root@wendang ~]# lsblk

NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda               8:0    0   50G  0 disk

├─sda1            8:1    0    1G  0 part /boot

├─sda2            8:2    0   15G  0 part

│ ├─centos-root 253:0    0 13.4G  0 lvm  /

│ └─centos-swap 253:1    0  1.6G  0 lvm  [SWAP]

└─sda3            8:3    0   10G  0 part

sr0              11:0    1 1024M  0 rom

[root@wendang ~]#  pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created.

[root@wendang ~]# vgs

VG     #PV #LV #SN Attr   VSize   VFree

centos   1   2   0 wz--n- <15.00g    0

[root@wendang ~]# vgextend centos /dev/sda3

Volume group "centos" successfully extended

[root@wendang ~]#  vgs

VG     #PV #LV #SN Attr   VSize  VFree

centos   2   2   0 wz--n- 24.99g <10.00g

[root@wendang ~]# lvs

LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

root centos -wi-ao---- 13.39g

swap centos -wi-ao----  1.60g

[root@wendang ~]# df -h

文件系统                 容量  已用  可用 已用% 挂载点

/dev/mapper/centos-root   14G  1.1G   13G    8% /

devtmpfs                 908M     0  908M    0% /dev

tmpfs                    920M     0  920M    0% /dev/shm

tmpfs                    920M  8.8M  911M    1% /run

tmpfs                    920M     0  920M    0% /sys/fs/cgroup

/dev/sda1               1014M  145M  870M   15% /boot

tmpfs                    184M     0  184M    0% /run/user/0

".

[root@wendang ~]# df -h

文件系统                 容量  已用  可用 已用% 挂载点

/dev/mapper/centos-root   14G  1.1G   13G    8% /

devtmpfs                 908M     0  908M    0% /dev

tmpfs                    920M     0  920M    0% /dev/shm

tmpfs                    920M  8.8M  911M    1% /run

tmpfs                    920M     0  920M    0% /sys/fs/cgroup

/dev/sda1               1014M  145M  870M   15% /boot

tmpfs                    184M     0  184M    0% /run/user/0

[root@wendang ~]#

[root@wendang ~]# lsblk

NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda               8:0    0   50G  0 disk

├─sda1            8:1    0    1G  0 part /boot

├─sda2            8:2    0   15G  0 part

│ ├─centos-root 253:0    0 13.4G  0 lvm  /

│ └─centos-swap 253:1    0  1.6G  0 lvm  [SWAP]

└─sda3            8:3    0   10G  0 part

sr0              11:0    1 1024M  0 rom

[root@wendang ~]# pvdisplay

--- Physical volume ---

PV Name               /dev/sda2

VG Name               centos

PV Size               <15.00 GiB / not usable 3.00 MiB

Allocatable           yes (but full)

PE Size               4.00 MiB

Total PE              3839

Free PE               0

Allocated PE          3839

PV UUID               mh1zwp-wM9K-iSCl-5fgJ-evDG-d3zZ-AozMWl

--- Physical volume ---

PV Name               /dev/sda3

VG Name               centos

PV Size               10.00 GiB / not usable 4.00 MiB

Allocatable           yes

PE Size               4.00 MiB

Total PE              2559

Free PE               2559

Allocated PE          0

PV UUID               IZJrH3-UswX-QXNe-Twih-oAR5-6cL3-l0LKGI

[root@wendang ~]# vgdisplay

--- Volume group ---

VG Name               centos

System ID

Format                lvm2

Metadata Areas        2

Metadata Sequence No  4

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                2

Open LV               2

Max PV                0

Cur PV                2

Act PV                2

VG Size               24.99 GiB

PE Size               4.00 MiB

Total PE              6398

Alloc PE / Size       3839 / <15.00 GiB

Free  PE / Size       2559 / <10.00 GiB

VG UUID               ZJCdml-lltw-AUau-NBJL-1QH1-2SAn-S5gbUB

[root@wendang ~]# lvdisplay

--- Logical volume ---

LV Path                /dev/centos/swap

LV Name                swap

VG Name                centos

LV UUID                hp3gdC-nima-jxLh-Be3r-c0dW-6n5S-Whnjfh

LV Write Access        read/write

LV Creation host, time wendang, 2019-09-17 00:12:50 +0800

LV Status              available

# open                 2

LV Size                1.60 GiB

Current LE             410

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                ZbNoyJ-6c9y-APnh-oxYl-clan-KbQN-qAwqo2

LV Write Access        read/write

LV Creation host, time wendang, 2019-09-17 00:12:50 +0800

LV Status              available

# open                 1

LV Size                13.39 GiB

Current LE             3429

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     8192

Block device           253:0

[root@wendang ~]# lvextend -L +9G /dev/mapper/centos-root

Size of logical volume centos/root changed from 13.39 GiB (3429 extents) to 22.39 GiB (5733 extents).

Logical volume centos/root successfully resized.

[root@wendang ~]# xfs_growfs /dev/mapper/centos-root

meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=877824 blks

=                       sectsz=512   attr=2, projid32bit=1

=                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=3511296, imaxpct=25

=                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal               bsize=4096   blocks=2560, version=2

=                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 3511296 to 5870592

[root@wendang ~]# df -h

文件系统                 容量  已用  可用 已用% 挂载点

/dev/mapper/centos-root   23G  1.1G   22G    5% /

devtmpfs                 908M     0  908M    0% /dev

tmpfs                    920M     0  920M    0% /dev/shm

tmpfs                    920M  8.8M  911M    1% /run

tmpfs                    920M     0  920M    0% /sys/fs/cgroup

/dev/sda1               1014M  145M  870M   15% /boot

tmpfs

184M     0  184M    0% /run/user/0

以下为纯命令

  1. fdisk /dev/sda 分区
  2. lsblk                    列出分区
  3. partprobe     刷新分区
  4. lsblk
  5. pvcreate /dev/sda3          创建物理卷
  6. vgs                                        查看卷组
  7. vgextend centos /dev/sda3     扩展卷组
  8. lvs              查看逻辑卷
  9. df –h    查看挂载
  10. pvdisplay           显示物理卷
  11. vgdisplay        显示卷组
  12. lvdisplay          显示逻辑卷
  13. lvextend -L +9G /dev/mapper/centos-root            扩展逻辑卷
  14. xfs_growfs /dev/mapper/centos-root              刷新文件系统容量
  15. df –h                   确认已经扩容
  16. ls
  17. pwd

LVM扩容根分区的更多相关文章

  1. virt-manager中为centos 7.2 扩容根分区

    1. 打开virt-manager,添加一块磁盘. Add Hardware --> 选中Storage --> Manager (操作参考下图) 点击Manager之后,弹出Choose ...

  2. Linux系统使用lvm扩展根分区

    Linux系统使用lvm扩展根分区 背景:买的云主机虚拟机封装镜像是40G的系统盘,后期适用不规范或者其他需求需要扩展系统盘,而非挂载在一个盘至新建目录. 1.原本目录磁盘等信息: 2.使用vgdis ...

  3. centos 7.4 磁盘空间不足,扩容根分区 --lvm模式

    背景:根分区磁盘空间不足,需要扩容root磁盘空间 1.查看现有磁盘信息,可以看出根分区有26G [root@localhost ~]# df -h 2.查看新增加的磁盘信息(改虚拟机已经添加好了,不 ...

  4. LVM缩小根分区

    逻辑卷不是根分区都可以在线扩容和缩小 根分区是可以在线扩容,但不可以在线缩小 Linux系统进入救援模式 依次选择: 欢迎界面 ---------- Rescue installed system C ...

  5. 【linux】lvm扩展根分区

    lvm扩展根目录 1.lvm的基本概念 physical volume (PV) 通常是一快硬盘.相当于一个物理设备,磁盘空间物理卷PV. volume group (VG) 相当于LVM的卷组,属于 ...

  6. 虚拟化下Centos7 扩容根分区

    查看分区大小和挂载情况 用到的命令df.lsblk [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/ ...

  7. Linux虚拟机扩容根分区CentOs6.9 VMware14

    1.首先关闭虚拟机点击编辑虚拟机设置 2.点击想要扩容的硬盘点击扩容 3.增加容量 输入想增加的容量,因为我本身是30G写到35G是加了5G不是增加30G.(此处为了演示只增加5G) 4.开启虚拟机 ...

  8. 单硬盘根分区扩容(非LVM)

    单用户模式(内核参数末尾加single)救援模式(用光盘启动,选第三个,rescue installed system) 救援模式有什么作用: 1可以更改root密码:2恢复硬盘.文件系统操作:3系统 ...

  9. CentOS7,非LVM根分区扩容步骤:

    1.查看现有的分区大小 非LVM分区,目前磁盘大小为40G,根分区总容量为40G,(是自定义分区安装的) 2.关机增加磁盘大小至100G 如果你们是vmwaer虚拟软件安装的那如下入扩容: 3.查看磁 ...

随机推荐

  1. CSS: hack 方式一览

    本文引自:http://blog.csdn.net/freshlover/article/details/12132801 什么是CSS hack 由于不同厂商的流览器或某浏览器的不同版本(如IE6- ...

  2. hadoop的基础思想

    转载 http://www.superwu.cn/2014/01/10/963 1.1.1. hadoop的核心思想 Hadoop包括两大核心,分布式存储系统和分布式计算系统.1.1.1.1. 分布式 ...

  3. 【POJ - 3259】Wormholes(最短路 Floyd算法)

    Wormholes 题目描述 教学楼里有很多教室,这些教室由双向走廊连接.另外,还存在一些单向的秘密通道,通过它们可以回到过去.现在有 N (1 ≤ N ≤ 500) 个教室,编号 1..N, M ( ...

  4. 洛谷 P2158 [SDOI2008]仪仗队

    题意简述 给定一个n,求gcd(x, y) = 1(x, y <= n)的(x, y)个数 题解思路 欧拉函数, 则gcd(x, y) = 1(x <= y <= n)的个数 ans ...

  5. 苹果电脑基本设置+Linux 命令+Android 实战集锦

    本文微信公众号「AndroidTraveler」首发. 背景 大多数应届毕业生在大学期间使用的比较多的是 windows 电脑,因此初入职场如果拿到一台苹果电脑,可能一时间不能够很快的上手.基于此,这 ...

  6. Goland_IDE的护眼、主题、字体等设置

    Goland_IDE的护眼.主题.字体等设置 1.代码格式化 File->Settings->Tools->File Watchers->+->go fmt->将N ...

  7. Linux 中如何查询端口被占用的情况

    Linux如何查看端口 1.lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000,如下图 可以看到8000端口已经被轻量级文件系统转发服务lwfs ...

  8. poj3415_Common Substrings

    题意 给定两个字符串,求长度大于等于k的公共子串数. 分析 将两个字符串中间加个特殊字符拼接,跑后缀数组. 将题目转化为对每一个后缀求\(\sum_{j=1}^{i-1}lcp(i,j)\),且后缀\ ...

  9. C#之项目常用方法之静态扩展

    一般项目中我们经常用到数据Json的序列化与反序列化,为了方便在需要的地方快速使用,一般建议都封装为静态扩展方法,在需要的地方可直接使用. 而目前C#项目中序列化一般都是用的 Newtonsoft.J ...

  10. MySQL之备份和还原

    在实际项目中对于数据库的安全是重中之重,为防万一我们需要做好备份工作.备份分为全量备份和增量备份,今天我们就来实践下备份和还原操作. 一.为什么需要备份 在生产环境中数据库可能会遭遇到各种各样的不测从 ...