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 存储空间为例来修改,如果需要改成其他大小的存储空间,参照此方法修改即可. 首先连 ...
随机推荐
- GWAS | 全基因组关联分析 | Linkage disequilibrium (LD)连锁不平衡 | 曼哈顿图 Manhattan_plot | QQ_plot | haplotype phasing
现在GWAS已经属于比较古老的技术了,主要是碰到严重的瓶颈了,单纯的snp与表现的关联已经不够,需要具体的生物学解释,这些snp是如何具体导致疾病的发生的. 而且,大多数病找到的都不是个别显著的snp ...
- css图片的全屏显示代码-css3
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" ...
- VPC配置介绍
VPC(Virtual Port-Channel)是Cisco Nexus系列交换机中的一个特性.它支持一个跨机箱的二层Port-Channel.对于第三方设备来说(交换机或服务器)物理上是连接到了两 ...
- 20180831xlVBA_WorkbooksCosolidate
Sub WorkbooksConsolidate() Rem 设置求和区域为 sheet名称/单元格区域;sheet名称/单元格区域 Const Setting As String = "S ...
- DAG最长路问题 hdu-1224
用DFS+记忆化写了一下,拓扑排序+DP的我还没弄明白.据说Codeforces 721C就是这类题目,因为有费用限制,DFS不太好写,有时间把DP法想明白来. #include <iostre ...
- spark app
使用Spark和Scala分析Apache访问日志 http://www.jdon.com/bigdata/analyzing-apache-access-logs-files-spark-scala ...
- confirm提示弹出确定和取消按钮
js----> var con = confirm('这是一个确定加取消的提示窗口') if(con==true){ document.write("点击了确定按钮") }e ...
- Lowest Common Ancestor of a Binary Search Tree(Java 递归与非递归)
题目描述: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in ...
- First Bad Version leetcode java
问题描述: You are a product manager and currently leading a team to develop a new product. Unfortunately ...
- 2018-2019 ACM-ICPC Brazil Subregional Programming Contest
A:留坑 B:二维sg函数,特判边界情况 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) / ...