美文网首页
Linux lvm在线扩容

Linux lvm在线扩容

作者: 糊涂蟲 | 来源:发表于2018-11-23 09:32 被阅读0次

1、查看磁盘空间

[root@bgd-mysql3 ~]# fdisk -l

Disk /dev/sda: 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: 0x000b7e20

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   209715199   103808000   8e  Linux LVM

Disk /dev/sdb: 966.4 GB, 966367641600 bytes, 1887436800 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_bgd--ngnix1-root: 102.1 GB, 102131302400 bytes, 199475200 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_bgd--ngnix1-swap: 4160 MB, 4160749568 bytes, 8126464 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

2、创建物理卷

[root@bgd-mysql3 ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.

3、查看物理卷

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos_bgd-ngnix1
  PV Size               <99.00 GiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              25343
  Free PE               1
  Allocated PE          25342
  PV UUID               vr9DRr-mwG8-89Vm-LmoV-Bqel-Ykga-HM5HLg
   
  "/dev/sdb" is a new physical volume of "900.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb
  VG Name               
  PV Size               900.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               fhbfRd-x6qx-KVCd-3SBF-5lXN-Z81W-SIrRQz

4、查看当前卷组

[root@bgd-mysql3 ~]# vgdisplay 
  --- Volume group ---
  VG Name               centos_bgd-ngnix1
  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               <99.00 GiB
  PE Size               4.00 MiB
  Total PE              25343
  Alloc PE / Size       25342 / 98.99 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               BFGY1M-PHqr-RBnE-87t2-bhYC-n7PX-idg4R1

5、扩展卷组,将/dev/sdb物理卷加到VG中

[root@bgd-mysql3 ~]# vgextend centos_bgd-ngnix1 /dev/sdb
  Volume group "centos_bgd-ngnix1" successfully extended

6、查看逻辑卷

[root@bgd-mysql3 ~]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/centos_bgd-ngnix1/root
  LV Name                root
  VG Name                centos_bgd-ngnix1
  LV UUID                2SnPdf-1zdM-lM5G-4fJz-oGve-JC2Z-fkTGUL
  LV Write Access        read/write
  LV Creation host, time bgd-ngnix1, 2018-11-21 13:08:20 +0800
  LV Status              available
  # open                 1
  LV Size                <95.12 GiB
  Current LE             24350
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos_bgd-ngnix1/swap
  LV Name                swap
  VG Name                centos_bgd-ngnix1
  LV UUID                l8jyte-4j0X-00Am-ich0-9qen-QLaW-LWTSHI
  LV Write Access        read/write
  LV Creation host, time bgd-ngnix1, 2018-11-21 13:08:21 +0800
  LV Status              available
  # open                 2
  LV Size                <3.88 GiB
  Current LE             992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

7、将VG空间划分到LV

[root@bgd-mysql3 ~]# lvextend -l +100%FREE /dev/centos_bgd-ngnix1/root
  Size of logical volume centos_bgd-ngnix1/root changed from <95.12 GiB (24350 extents) to <995.12 GiB (254750 extents).
  Logical volume centos_bgd-ngnix1/root successfully resized.

8、重定义空间大小

[root@bgd-mysql3 ~]# xfs_growfs /dev/centos_bgd-ngnix1/root
meta-data=/dev/mapper/centos_bgd--ngnix1-root isize=512    agcount=4, agsize=6233600 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=24934400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=12175, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 24934400 to 260864000

以上是OS7的命令,OS6的命令如下

resize2fs /dev/mapper/centos-root    ---centos

9、查看空间

[root@bgd-mysql3 ~]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
/dev/mapper/centos_bgd--ngnix1-root  996G  1.7G  994G   1% /
devtmpfs                             3.9G     0  3.9G   0% /dev
tmpfs                                3.9G     0  3.9G   0% /dev/shm
tmpfs                                3.9G  8.8M  3.9G   1% /run
tmpfs                                3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                           1014M  184M  831M  19% /boot
tmpfs                                783M     0  783M   0% /run/user/0

相关文章

  • 存储管理Ⅱ-swap、逻辑卷

    一.存储管理Ⅱ 1.逻辑卷LVM 1.1.LVM管理 在线扩容 online 创建LVM VG的扩容 LVM的扩容...

  • Linux lvm在线扩容

    1、查看磁盘空间 2、创建物理卷 3、查看物理卷 4、查看当前卷组 5、扩展卷组,将/dev/sdb物理卷加到VG...

  • lvm 在线扩容

    1.先查看逻辑卷组空间是否足够 [root@test server]# vgdisplay --- Volume...

  • 10.Linux LVM 磁盘扩容

    Linux LVM 磁盘扩容 LVM 的基本概念 物理卷 Physical Volume (PV): 可以在上面建...

  • Linux磁盘挂载和扩容(2)

    本章介绍Linux系统磁盘扩容问题 前言 想到Linux服务器磁盘扩容我们会想到几种办法 挂载lvm方式,然后扩展...

  • Linux LVM扩容

    linux下 lvm 磁盘扩容 打算给系统装一个oracle,发现磁盘空间不足。在安装系统的时候我选择的是自动分区...

  • LV扩容(lvextend)

    LV扩容 一、 LVM概述 在 Linux 系统中,我们经常使用 LVM (逻辑卷管理)的方式去管理和使用磁盘, ...

  • 【转】Esxi上Linux虚拟机硬盘(LVM)扩容文档

    Esxi上Linux虚拟机硬盘(LVM)扩容文档 banyejinghungui 1人评论 [23153人阅读][...

  • 2020-03-23 LVM

    1.创建lvm 2.删除lvm 3.lvm fs扩容 4.vg扩容pvcreate /dev/sddvgexten...

  • Linux 单磁盘根分区扩容-非 LVM

    Linux 单磁盘根分区扩容-非 LVM 硬件:DELL R720 系统:XEN 虚拟系统:CentOS 6.5 ...

网友评论

      本文标题:Linux lvm在线扩容

      本文链接:https://www.haomeiwen.com/subject/mopdqqtx.html