1,创建分区

[root@host-10-158-172-44 ~]# fdisk /dev/vda

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.

Command (m for help): n

Partition type:

p primary (2 primary, 0 extended, 2 free)

e extended

Select (default p): Enter

Partition number (3,4, default 3): Enter

First sector (41943040-83886079, default 41943040): Enter

Using default value 41943040

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

Using default value 83886079

Partition 3 of type Linux and of size 20 GiB is set

Command (m for help): t

Partition number (1-3, default 3): Enter

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[root@host-10-158-172-44 ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0009b56e

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 1026047 512000 83 Linux

/dev/vda2 1026048 41943039 20458496 8e Linux LVM

/dev/vda3 41943040 83886079 20971520 8e Linux LVM

Disk /dev/mapper/centos-root: 18.8 GB, 18756927488 bytes, 36634624 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: 2147 MB, 2147483648 bytes, 4194304 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,创建PV

[root@host-10-158-172-44 ~]# partprobe #使分区表生效,无需重启

[root@host-10-158-172-44 ~]# pvcreate /dev/vda3 #使用pvcreate转换

WARNING: dos signature detected on /dev/vda3 at offset 510. Wipe it? [y/n]: y

Wiping dos signature on /dev/vda3.

Physical volume "/dev/vda3" successfully created

[root@host-10-158-172-44 ~]# pvdisplay #查看已经存在的pv

--- Physical volume ---

PV Name /dev/vda2

VG Name centos

PV Size 19.51 GiB / not usable 3.00 MiB

Allocatable yes

PE Size 4.00 MiB

Total PE 4994

Free PE 10

Allocated PE 4984

PV UUID 2MR7wz-fh1t-6nlO-glse-MEBz-8Rjo-Y7gkhI

"/dev/vda3" is a new physical volume of "20.00 GiB"

--- NEW Physical volume ---

PV Name /dev/vda3

VG Name

PV Size 20.00 GiB

Allocatable NO

PE Size 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID dvb6J8-YszL-KP8x-LDHc-RGwT-pB3u-s19Pe9

3,扩展VG

[root@host-10-158-172-44 ~]# vgextend centos /dev/vda3

Volume group "centos" successfully extended

[root@host-10-158-172-44 ~]# vgdisplay #查看已经存在的vg

--- 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 39.50 GiB

PE Size 4.00 MiB

Total PE 10113

Alloc PE / Size 4984 / 19.47 GiB

Free PE / Size 5129 / 20.04 GiB

VG UUID h5CW2E-aYjt-AZLN-CTMe-7lZp-e2xk-yuDnLs

4,扩展LV

[root@host-10-158-172-44 ~]# lvdisplay #查看已经存在的lv

--- Logical volume ---

LV Path /dev/centos/swap

LV Name swap

VG Name centos

LV UUID U0ANhF-afAc-pb0U-AYmN-EJH0-Wyj8-H2bvws

LV Write Access read/write

LV Creation host, time localhost, 2015-12-01 21:35:58 +0800

LV Status available

# open 2

LV Size 2.00 GiB

Current LE 512

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 sG5AuB-SsYW-ggN5-tl6l-csEg-14F7-6NNVnO

LV Write Access read/write

LV Creation host, time localhost, 2015-12-01 21:35:59 +0800

LV Status available

# open 1

LV Size 17.47 GiB

Current LE 4472

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 8192

Block device 253:0

[root@host-10-158-172-44 ~]# lvextend -L 37G /dev/centos/root #扩展lv

Size of logical volume centos/root changed from 20.00 GiB (5120 extents) to 37.00 GiB (9472 extents).

Logical volume root successfully resized

注:lvextend -r -l +100%FREE /dev/centos/root #可使用此命令将所有的vg全部分配

5,执行重设大小

[root@host-10-158-172-44 ~]# xfs_growfs /dev/mapper/centos-root #重设大小

meta-data=/dev/mapper/centos-root isize=256 agcount=5, agsize=1144832 blks

= sectsz=512 attr=2, projid32bit=1

= crc=0 finobt=0

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

= sunit=0 swidth=0 blks

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

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 5242880 to 9699328

[root@host-10-158-172-44 ~]# df -h #查看

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 37G 789M 37G 3% /

devtmpfs 1.9G 0 1.9G 0% /dev

tmpfs 1.9G 0 1.9G 0% /dev/shm

tmpfs 1.9G 8.4M 1.9G 1% /run

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

/dev/vda1 497M 120M 378M 25% /boot

lvm硬盘管理及LVM扩容的更多相关文章

  1. [转载]Linux LVM硬盘管理及LVM扩容

    最近项目中一直在用Linux,其中涉及到了Linux的LVM,本来想自己写一篇关于LVM的文章,搜了一下,发现了一篇更好的,转载过来,也感谢作者gaojun 原文Linux LVM硬盘管理及LVM扩容 ...

  2. Linux LVM硬盘管理及LVM扩容

    LVM磁盘管理 一.LVM简介... 1 二. LVM基本术语... 2 三. 安装LVM... 3 四. 创建和管理LVM... 4 2. 创建PV.. 6 3. 创建VG.. 7 4. 创建LV. ...

  3. Linux LVM硬盘管理及LVM分区扩容

    LVM磁盘管理 一.LVM简介... 1 二. LVM基本术语... 2 三. 安装LVM... 3 四. 创建和管理LVM... 4 2. 创建PV.. 6 3. 创建VG.. 7 4. 创建LV. ...

  4. Linux LVM硬盘管理及LVM扩容【转】

    原文地址:http://www.cnblogs.com/gaojun/archive/2012/08/22/2650229.html 一.LVM简介 LVM是 Logical Volume Manag ...

  5. Linux LVM硬盘管理之一:概念介绍

    一.LVM概念介绍: LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在Linux 2.4内核上实现.LVM将一个或多个硬盘的分区在逻 ...

  6. Linux LVM硬盘管理之二:创建逻辑卷步骤

    创建逻辑卷(LV)的顺序:Linux分区---物理卷(PV)---卷组(VG)---逻辑卷(LV)---挂载到文件系统 删除逻辑卷(LV)的顺序:卸载文件系统----逻辑卷(LV)---卷组(VG)- ...

  7. LVM磁盘管理

    http://www.cnblogs.com/gaojun/archive/2012/08/22/2650229.html Linux LVM硬盘管理及LVM扩容 LVM磁盘管理 一.LVM简介... ...

  8. Linux逻辑卷管理器(LVM)

    LVM基础 通过使用Linux的逻辑卷管理器(Logical Volume Manager, LVM),用户可以在系统运行时动态调整文件系统的大小,把数据从一块硬盘重定位到另一块硬盘,也可以提高I/O ...

  9. Disk:磁盘管理之LVM和系统磁盘扩容

    简介 小伙伴们好,好久不见,今天想给大家介绍一下关于磁盘管理的方法和心得:磁盘管理可谓运维工作中的重要内容,主要包括磁盘的合理规划以及扩缩容 常用的磁盘管理方法为LVM(Logical Volume ...

随机推荐

  1. git--客户端管理工具初步使用

    说点废话哈 小白一枚, 今年3月份进入自己的第一家公司, 开始成为前端中的一份子,好在公司里有位和我一同进来的一位老哥带着我,从老哥身上学到的知识不多,(因为和老哥只相处工作了三个月,因为家里的事情, ...

  2. HDU 1028 Ignatius and the Princess III(母函数整数拆分)

    链接:传送门 题意:一个数n有多少种拆分方法 思路:典型母函数在整数拆分上的应用 /********************************************************** ...

  3. vue 删除某个元素和删除某些元素

    今天做项目使用前端vue框架,需要循环遍历去删除一些数组元素.开始思想局限,一直纠结如何去循环删除,犹豫循环删除数组值下标会发生变化,并不是一种好的方法. 方法一:使用forEach 和 splice ...

  4. 【codeforces 747E】Comments

    [题目链接]:http://codeforces.com/problemset/problem/747/E [题意] 给你一个类似递归的结构; 让你把每一层的字符串按照层,一层层地输出出来; 并输出层 ...

  5. Spring MVC学习总结(7)——Spring MVC整合Ehcache缓存框架

    Ehcache算是当前比较流行的缓存框架,使用缓存可以极大的缓解服务器和数据库的压力,提高访问效率,提高服务器的并发能力.接下来我们看怎么把缓存使用起来. SpringMVC集成Ehcache所需的j ...

  6. POJ 3696

    这里面的一个转换的小技巧很重要,把888...8转换成(10^x-1)/9*8.神来之笔,佩服. 这样有(10^x-1)/9*8=L*p得10^x-1=L*p*9/8,设m=9*L/gcd(L,8). ...

  7. hello world to php( mac 配置 xmapp virtual host)

    一.安装xmapp.安装完以后查看,服务是否都能启动(数据库和server) 二.配置自己的virtualhost       1.系统host文件加入server的域名(在浏览器中输入域名后会先通过 ...

  8. iptables 防火墙 只允许某IP访问某端口、访问特定网站

    iptables 防火墙 只允许某IP访问某端口.访问特定网站 1.先备份iptables /var/tmp 需要开80端口,指定IP和局域网 下面三行的意思: 先关闭所有的80端口 开启ip段192 ...

  9. m_Orchestrate learning system---二十一、怎样写算法比较轻松

    m_Orchestrate learning system---二十一.怎样写算法比较轻松 一.总结 一句话总结:(1.写出算法步骤,这样非常有利于理清思路,这样就非常简单了 2.把问题分细,小问题用 ...

  10. nyoj-737--石子合并(一)(动态规划)

    石子合并(一) 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述     有N堆石子排成一排,每堆石子有一定的数量.现要将N堆石子并成为一堆.合并的过程只能每次将相邻的两堆 ...