1.在关机状态下,在Vm里面设置系统大小到需要的数值 ;
2.使用root权限登陆linux,df -h查看系统情况;

[root@cratedb-hk-01 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 50G 1.5G 49G 3% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.2G 0 3.2G 0% /dev/shm
tmpfs 3.2G 9.1M 3.2G 1% /run
tmpfs 3.2G 0 3.2G 0% /sys/fs/cgroup
/dev/xvda1 1014M 185M 830M 19% /boot
/dev/mapper/centos-home 46G 33M 46G 1% /home
tmpfs 649M 0 649M 0% /run/user/0

  fdisk -l

[root@cratedb-hk-01 ~]# fdisk -l

磁盘 /dev/xvda:214.7 GB, 214748364800 字节,419430400 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009e984 设备 Boot Start End Blocks Id System
/dev/xvda1 * 2048 2099199 1048576 83 Linux
/dev/xvda2 2099200 209715199 103808000 8e Linux LVM

3.没有找到挂载点,默认是/dev/sda或/dev/xvda必须要先试用fdisk格式化,初始化挂载磁盘才可以使用

[root@cratedb-hk-01 ~]# fdisk /dev/xvda
欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。 命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) 命令(输入 m 获取帮助):p 磁盘 /dev/xvda:214.7 GB, 214748364800 字节,419430400 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009e984 设备 Boot Start End Blocks Id System
/dev/xvda1 * 2048 2099199 1048576 83 Linux
/dev/xvda2 2099200 209715199 103808000 8e Linux LVM 命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) 命令(输入 m 获取帮助):n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
分区号 (3,4,默认 3):3
起始 扇区 (209715200-419430399,默认为 209715200):
将使用默认值 209715200
Last 扇区, +扇区 or +size{K,M,G} (209715200-419430399,默认为 419430399):
将使用默认值 419430399
分区 3 已设置为 Linux 类型,大小设为 100 GiB 命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) 命令(输入 m 获取帮助):t
分区号 (1-3,默认 3):3
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM” 命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) 命令(输入 m 获取帮助):w
The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
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)
正在同步磁盘。

4:重启服务器

  reboot

[root@cratedb-hk-01 ~]# fdisk -l

磁盘 /dev/xvda:214.7 GB, 214748364800 字节,419430400 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009e984 设备 Boot Start End Blocks Id System
/dev/xvda1 * 2048 2099199 1048576 83 Linux
/dev/xvda2 2099200 209715199 103808000 8e Linux LVM
/dev/xvda3 209715200 419430399 104857600 8e Linux LVM

5:格式化分区,mkfs.ext3 /dev/xvda3一直挂载的分区是xvda3;

[root@cratedb-hk-01 ~]# mkfs.ext3 /dev/xvda3
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
800 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: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

6:输入以下指令:

[root@cratedb-hk-01 ~]# lvm
lvm> pvcreate /dev/xvda3
WARNING: ext3 signature detected on /dev/xvda3 at offset 1080. Wipe it? [y/n]: y
Wiping ext3 signature on /dev/xvda3.
Physical volume "/dev/xvda3" successfully created.
lvm> vgextend centos /dev/xvda3
Volume group "centos" successfully extended
lvm> vgdisplay -v
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size 198.99 GiB
PE Size 4.00 MiB
Total PE 50942
Alloc PE / Size 25342 / 98.99 GiB
Free PE / Size 25600 / 100.00 GiB
VG UUID Sa8iIa-EBdf-F0Zz-IJ3z-Xozx-L0Ob-ThRrNk --- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 807WWG-hzhk-ichE-AEO2-HKaU-yCe4-rd8lob
LV Write Access read/write
LV Creation host, time localhost, 2019-01-18 15:47:56 +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 --- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID Lhl3gA-NKbL-8mod-hAiR-TE7G-9ZUC-PsfGG9
LV Write Access read/write
LV Creation host, time localhost, 2019-01-18 15:47:56 +0800
LV Status available
# open 1
LV Size <45.12 GiB
Current LE 11550
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2 --- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID fOFhxK-gwNY-zuht-W64P-dQ5H-hTUJ-qXTSRk
LV Write Access read/write
LV Creation host, time localhost, 2019-01-18 15:47:56 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0 --- Physical volumes ---
PV Name /dev/xvda2
PV UUID ZItt1Y-FCC3-IxP9-Pw7C-0aJi-Yee4-WG3005
PV Status allocatable
Total PE / Free PE 25343 / 1 PV Name /dev/xvda3
PV UUID i3nEKb-grlP-cY7S-ayUf-WErf-d0dn-PMLRv3
PV Status allocatable
Total PE / Free PE 25599 / 25599 lvm> lvextend -l +25599 /dev/mapper/centos-root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to <150.00 GiB (38399 extents).
Logical volume centos/root successfully resized.
lvm> pvdisplay
--- Physical volume ---
PV Name /dev/xvda2
VG Name centos
PV Size <99.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25343
Free PE 0
Allocated PE 25343
PV UUID ZItt1Y-FCC3-IxP9-Pw7C-0aJi-Yee4-WG3005 --- Physical volume ---
PV Name /dev/xvda3
VG Name centos
PV Size 100.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 25599
Free PE 1
Allocated PE 25598
PV UUID i3nEKb-grlP-cY7S-ayUf-WErf-d0dn-PMLRv3 lvm> quit
Exiting.

7:扩展容量:

[root@cratedb-hk-01 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 39320576

8:使用df -h查看

[root@cratedb-hk-01 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 150G 1.5G 149G 1% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 2.4G 0 2.4G 0% /dev/shm
tmpfs 2.4G 9.0M 2.4G 1% /run
tmpfs 2.4G 0 2.4G 0% /sys/fs/cgroup
/dev/xvda1 1014M 185M 830M 19% /boot
/dev/mapper/centos-home 46G 33M 46G 1% /home
tmpfs 484M 0 484M 0% /run/user/0
[root@cratedb-hk-01 ~]#

感谢:

https://www.cnblogs.com/panghaohan/p/6477517.html

Centos7扩展存储空间的更多相关文章

  1. Centos7 根目录存储空间扩展方法

    Centos7 根目录存储空间扩展方法   一.首先通过 df -hl 命令查看磁盘占用情况,其中根目录已经被占满,此时需要对其进行扩容   二.针对虚拟机环境的centos7系统根存储空间扩容,可利 ...

  2. 【CentOS7.0】虚拟机如何实现扩展存储空间

    写在前面的一些小废话 有时候,虚拟机随着使用,会导致存储不够,这时就需要给虚拟机扩容. 扩容的前提是,此虚拟机没有快照. 扩容时,需要编辑虚拟机设置.为了形成对比,第一张图片是扩容前,第二张图片是扩容 ...

  3. 虚拟机vmware centos7 扩展磁盘空间

    0.思路 创建一个新的逻辑分区,将新的逻辑分区格式化ext3(或其他类型)的文件系统,mount到磁盘空间不够的文件系统,就跟原来的分区/文件系统一样的使用 1.准备 1.1 注意使用VMware自带 ...

  4. VM环境下Linux虚拟机扩展存储空间操作方法总结

    用VMwareware虚拟机安装的 Linux 系统剩余空间不足,造成软件无法正常安装.如果重新装一遍系统就需要重新配置好开发环境和软件的安装配置. 一.空间扩展  (1)打开VMware,选择Edi ...

  5. centos7扩展根分区

    参考网站:http://www.360doc.com/content/18/0128/11/52410512_725728162.shtml VirtualBox中安装了CentOS 7,给同事用来做 ...

  6. Centos7扩展磁盘空间(LVM管理)

    vmware或hyperv,扩容磁盘,本例中使用的是vmware,关闭系统,在vmware—>设置—>硬盘—>扩展—>输入数字大于当前系统内存—>点击扩展,如图: 1.  ...

  7. centos7扩展磁盘空间

    [root@hn ~]# fdisk /dev/sdb The device presents a logical sector size that is smaller thanthe physic ...

  8. [嵌入式开发板]iTOP-4412开发板linux 系统存储空间的修改

    平台:iTOP-4412开发板 这里我们以修改成 1G 存储空间为例来讲解修改方法, 如果需要改 成其他大小的存储空间,参照此方法修改即可. 首先连接好 iTOP-4412 开发板的调试串口到 pc  ...

  9. [转帖]迅为4412开发板最小linux系统的存储空间修改

    本文转自迅为论坛:http://www.topeetboard.com 最小linux系统的存储空间修改以修改成 1G 存储空间为例来修改,如果需要改成其他大小的存储空间,参照此方法修改即可. 首先连 ...

随机推荐

  1. for...in和for...of循环的区别

    使用for...in和for...of分别对Array,Set,Map做测试 var a=["A","B","C"]; var b=new ...

  2. caffe在win10下的安装与配置

    1.Windows环境caffe安装配置(无GPU) 参考:http://www.cnblogs.com/cxyxbk/p/5902034.html 解压caffe-windows文件,将./wind ...

  3. English trip M1 - AC9 Nosey people 爱管闲事的人 Teacher:Solo

    In this lesson you will learn to talk about what happened. 在本课中,您将学习如何谈论发生的事情. 课上内容(Lesson) # four “ ...

  4. 20170920xlVBA_FTP_UpDownLoad_DownLoad

    '建立应用环境进程 Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpen ...

  5. drf 认证、权限、限流、过滤、排序、分页器

    认证Authentication 准备工作:(需要结合权限用) 1. 需要使用到登陆功能,所以我们使用django内置admin站点并创建一个管理员. python manage.py creates ...

  6. 小程序点击跳转外部链接 微信小程序提示:不支持打开非业务域名怎么办 使用web-view 配置业务域名

    小程序点击跳转外部页面 1.index.wxml  添加点击事件   标签可以是小程序支持的 <!-- 邀请好友 --> <cover-image src='/img/invitat ...

  7. 【洛谷 P1216】【IOI1994】【USACO1.5】数字三角形 Number Triangles

    (如此多的标签qaq) 数字三角形 Number Triangles[传送门] 本来打算当DP练的,没想到写着写着成递推了(汗) 好的没有时间了,我们附个ac代码(改天不写): #include< ...

  8. 【IDEA】【4】遇到的问题

    前言: 1,jar包未导入到项目中 2,报错 cannot resolve symbol 3,左边栏只能看到文件看不到项目结构 4,报错 No valid Maven installation fou ...

  9. 使用CSDN-markdown编辑器

    欢迎使用Markdown编辑器写博客 本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接 ...

  10. 把旧系统迁移到.Net Core 2.0 日记(1) - Startup.cs 解析

    因为自己到开发电脑转到Mac Air,之前的Webform/MVC应用在Mac 跑不起来,而且.Net Core 2.0 已经比较稳定了. 1. 为什么会有跨平台的.Net Core  近年来,我们已 ...