Centos7扩展存储空间
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扩展存储空间的更多相关文章
- Centos7 根目录存储空间扩展方法
Centos7 根目录存储空间扩展方法 一.首先通过 df -hl 命令查看磁盘占用情况,其中根目录已经被占满,此时需要对其进行扩容 二.针对虚拟机环境的centos7系统根存储空间扩容,可利 ...
- 【CentOS7.0】虚拟机如何实现扩展存储空间
写在前面的一些小废话 有时候,虚拟机随着使用,会导致存储不够,这时就需要给虚拟机扩容. 扩容的前提是,此虚拟机没有快照. 扩容时,需要编辑虚拟机设置.为了形成对比,第一张图片是扩容前,第二张图片是扩容 ...
- 虚拟机vmware centos7 扩展磁盘空间
0.思路 创建一个新的逻辑分区,将新的逻辑分区格式化ext3(或其他类型)的文件系统,mount到磁盘空间不够的文件系统,就跟原来的分区/文件系统一样的使用 1.准备 1.1 注意使用VMware自带 ...
- VM环境下Linux虚拟机扩展存储空间操作方法总结
用VMwareware虚拟机安装的 Linux 系统剩余空间不足,造成软件无法正常安装.如果重新装一遍系统就需要重新配置好开发环境和软件的安装配置. 一.空间扩展 (1)打开VMware,选择Edi ...
- centos7扩展根分区
参考网站:http://www.360doc.com/content/18/0128/11/52410512_725728162.shtml VirtualBox中安装了CentOS 7,给同事用来做 ...
- Centos7扩展磁盘空间(LVM管理)
vmware或hyperv,扩容磁盘,本例中使用的是vmware,关闭系统,在vmware—>设置—>硬盘—>扩展—>输入数字大于当前系统内存—>点击扩展,如图: 1. ...
- centos7扩展磁盘空间
[root@hn ~]# fdisk /dev/sdb The device presents a logical sector size that is smaller thanthe physic ...
- [嵌入式开发板]iTOP-4412开发板linux 系统存储空间的修改
平台:iTOP-4412开发板 这里我们以修改成 1G 存储空间为例来讲解修改方法, 如果需要改 成其他大小的存储空间,参照此方法修改即可. 首先连接好 iTOP-4412 开发板的调试串口到 pc ...
- [转帖]迅为4412开发板最小linux系统的存储空间修改
本文转自迅为论坛:http://www.topeetboard.com 最小linux系统的存储空间修改以修改成 1G 存储空间为例来修改,如果需要改成其他大小的存储空间,参照此方法修改即可. 首先连 ...
随机推荐
- 雷林鹏分享:使用 CSS 显示 XML
使用 CSS 显示 XML 通过使用 CSS(Cascading Style Sheets 层叠样式表),您可以添加显示信息到 XML 文档中. 使用 CSS 显示您的 XML? 使用 CSS 来格式 ...
- Python实现一条基于POS算法的区块链
区块链中的共识算法 在比特币公链架构解析中,就曾提到过为了实现去中介化的设计,比特币设计了一套共识协议,并通过此协议来保证系统的稳定性和防攻击性. 并且我们知道,截止目前使用最广泛,也是最被大家接受的 ...
- gcc优化引起get_free_page比__get_free_page返回值多4096
2017-12-12 18:53:04 gcc优化引起get_free_page比__get_free_page返回值多4096 内核版本:1.3.100 extern inline unsigned ...
- Selenium-WebDriverApi接口详解
浏览器操作 # 刷新 driver.refresh() # 前进 driver.forward() # 后退 driver.back() 获取标签元素 # 通过ID定位目标元素 driver.find ...
- 常用的jquery遍历函数
1.Jquery遍历祖先 1).parent() 方法返回被选元素的直接父元素. 2).parents() 方法返回被选元素的所有祖先元素,它一路向上直到文档的根元素 (<html>) ...
- git:not a git repository (or any of the parent directories)
我用git add file添加文件时出现了这样错误: fatal: Not a git repository (or any of the parent directories): .git 提示说 ...
- Eclipse直接打开类文件/文件夹所在的本地目录
1.Eclipse原生的文件浏览操作 选择项目目录/文件 按 ALT+SHIFT +W , 会弹出菜单点击 System Explorer 就可以打开文件所在的本地目录了: 设置工具目录 Run -- ...
- python中eval()和json.dumps的使用
在python中通过requests.get(url)获取json数据,此时可能需要eval进行解析. # -*- coding: utf-8 -*- import requests r = requ ...
- linux -- 基于zookeeper搭建yarn的HA高可用集群
linux -- 基于zookeeper搭建yarn的HA高可用集群 实现方式:配置yarn-site.xml配置文件 <configuration> <property> & ...
- 微信小程序 带参调用后台接口 循环渲染页面 wx.request wx:for
test.js 文件里的onLoad function getarticles(p,order,mythis) { wx.request({ url: 'https://ganggouo.cn/ind ...