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 存储空间为例来修改,如果需要改成其他大小的存储空间,参照此方法修改即可. 首先连 ...
随机推荐
- spring boot ----> jpa连接和操作mysql数据库
环境: centos6.8,jdk1.8.0_172,maven3.5.4,vim,spring boot 1.5.13,mysql-5.7.23 1.引入jpa起步依赖和mysql驱动jar包 &l ...
- WCF服务寄宿IIS与Windows服务 - C#/.NET
WCF是Windows平台下程序间通讯的应用程序框架.整合和 .net Remoting,WebService,Socket的机制,是用来开发windows平台上分布式开发的最佳选择.wcf程序的运行 ...
- NYOJ - 整数划分(四)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=746 要求对一个n的整数插入m个乘号,求最大结果. 构造dp:dp[i][j]表示枚举至j ...
- android -------- Data Binding的使用 ( 五) include
Data Binding的中 include 标签的使用 inclune使用和原来一样,但要如何使数据也在 include中使用呢? 先看看我的布局文件 include的布局文件,也要使用 <l ...
- DP 要求将承载量花光的01背包问题
前言:很久没有发博客了,以后会捡起来,之后很长一段时间内我都会把精力放在攻克DP问题上,所以会经常上传一些DP学习笔记,把一些比较好的,没见过类型的DP问题都会传上来,希望能够变强吧. 因为今天很清醒 ...
- arguments.callee用法
arguments.callee 在哪一个函数中运行,它就代表哪一个函数. 一般用在匿名函数中. 在匿名函数中有时会需要自己调用自己,但是由于是匿名函数,没有名子,无名可调. 这时就可以用argume ...
- meta标签常用设置
<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 --> <html lang="zh-cmn-Hans"&g ...
- ubuntu 远程登录服务器和服务器中下载代码
1.首先用远程登录:ssh 名称@地址 2.提示输入密码. 3.进入到你所要文件目录. 输入:tar cf 文件明.tar 你自己喜欢的文件/ 下载:scp erpAmazonAPI.tar 主机名称 ...
- [codechef July Challenge 2017] Pishty and tree
PSHTTR: Pishty 和城堡题目描述Pishty 是生活在胡斯特市的一个小男孩.胡斯特是胡克兰境内的一个古城,以其中世纪风格的古堡和非常聪明的熊闻名全国.胡斯特的镇城之宝是就是这么一座古堡,历 ...
- GitHub 简单用法
1. GitHub账号的申请 首先打开Github主页,https://github.com 如果你没有登录过的话会打开如下图的界面(登录过你就不用看这段了), 注册画面如下: 注意右侧不是登陆界面而 ...