Linux系统扩容根目录磁盘空间的操作方法
问题描述
系统的服务无法正常运行,查看磁盘空间,发现根目录已经满了

解决过程
1.添加磁盘空间
2.使用fdisk -l命令查看磁盘信息
3.新建磁盘分区
4.使用fdisk /dev/sda3, 创建新分区。
按照下面Linux操作进行分区。
root@ubuntu14:/opt# fdisk /dev/sda3
命令(输入 m 获取帮助): m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
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 #new 新分区
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): p #选择主分区
分区号 (1-4,默认为 3): 3 #分区序号
起始 sector (499712-314572799,默认为 499712): #分区开始回车默认
将使用默认值 499712
Last sector, +扇区 or +size{K,M,G} (499712-501757,默认为 501757):
将使用默认值 501757
命令(输入 m 获取帮助): n #new 新分区
Partition type:
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
Select (default p): p #选择主分区
Selected partition 4 #分区序号
起始 sector (62912512-314572799,默认为 62912512): #分区开始回车默认
将使用默认值 62912512
Last sector, +扇区 or +size{K,M,G} (62912512-314572799,默认为 314572799):
将使用默认值 314572799
命令(输入 m 获取帮助): t #修改分区格式
分区号 (1-5): 4 #修改分区号
Hex code (type L to list codes): 8e #格式选择8e linux LVM
Changed system type of partition 4 to 8e (Linux LVM)
命令(输入 m 获取帮助): p #显示分区信息
Disk /dev/vda: 161.1 GB, 161061273600 bytes
16 heads, 63 sectors/track, 312076 cylinders, total 314572800 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001a023
设备 启动 起点 终点 块数 Id 系统
/dev/vda1 * 2048 499711 248832 83 Linux
/dev/vda2 501758 62912511 31205377 5 扩展
/dev/vda3 499712 501757 1023 83 Linux
/dev/vda4 62912512 314572799 125830144 8e Linux LVM
/dev/vda5 501760 62912511 31205376 8e Linux LVM
Partition table entries are not in disk order
命令(输入 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)
Syncing disks.

5.重启Linux操作系统,使用reboot命令。
6.创建物理卷,使用pvcreate /dev/sda3命令。

7.将添加新的物理卷,加载到centos卷组,使用vgextend centos /dev/sda3命令。

8.增加/dev/mapper/centos-root大小,增加50G。使用lvresize -L +50G /dev/mapper/centos-root命令。

9.同步文件系统。

10.查看扩容后的大小 ,使用df -h命令。

参考:
https://www.jb51.net/article/144291.htm
http://blog.51cto.com/sf1314/2062106
Linux系统扩容根目录磁盘空间的操作方法的更多相关文章
- Linux系统扩容根目录磁盘空间
作者:非法小恋 一.使用背景 Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变. 产生的原因是没有给磁盘格式化,没有增加分区. 二. ...
- VMware 虚拟机(linux)增加根目录磁盘空间 转自
转自 http://wenku.baidu.com/link?url=WZDgESO0oXqYfhPYOWFalZsMglS0HKtLw7t6ICRs_sJ_sfPc85RpxsqKMwqSniis0 ...
- VMware 虚拟机(linux)增加根目录磁盘空间
今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录使用率已达到80%,导致系统运行很慢.我用以下方法扩大根目录磁 ...
- 【重新挂载磁盘空间】Linux系统/home的磁盘空间重新挂载给/root
以下是在centos7版本上做测试 使用如下命令查看磁盘使用情况 ls -lh 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9 ...
- linux 系统扩容 VMware Centos---VMware ESXi
用到的命令 df fdisk pvcreate pvdisplay vgdisplay vgextend lvdisplay lvextend resize2fs 0 ...
- VMware 虚拟机(linux)增加根目录磁盘空间
VMware 虚拟机(linux)增加根目录磁盘空间 今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录 ...
- 解决Linux下pcieport 0000:00:1c.5问题导致的系统根目录/磁盘空间不足
最近刚换了笔记本,拿到本后在win10基础装上Ubuntu 16.04双系统,有个问题是每次关机都会报一堆pcie问题,并且经常没声音,声音问题通过上一篇文章暂时解决,然后就没在意了,可是几天后出现系 ...
- Linux学习之CentOS(十七)-----释放 Linux 系统预留的硬盘空间 与Linux磁盘空间被未知资源耗尽 (转)
释放 Linux 系统预留的硬盘空间 大多数文件系统都会保留一部分空间留作紧急情况时用(比如硬盘空间满了),这样能保证有些关键应用(比如数据库)在硬盘满的时候有点余地,不致于马上就 crash,给监 ...
- Linux Shell之监测磁盘空间
Linux Shell之监测磁盘空间 系统管理员的另一个重要任务就是监测系统磁盘的使用情况.不管运行的是简单Linux台式机还是大型的Linux服务器,我们都要知道还有多少空间可以留给应用程序.事实上 ...
随机推荐
- mybatis 参数格式异常-- Error querying database. Cause: java.lang.NumberFormatException: For input string
mybatis中 <if></if>标签中进行判断时,如果传入的时字符格式和数字进行判断需要将数字进行转译,否则默认是数字和数字进行比较,这是就会出现参数格式异常如<if ...
- fullpage 全屏插件
fullpage 全屏插件 全屏滚动效果,原生js也很好实现,主要是用 mousewheel 鼠标滚轮滚动事件, 来判断上滚动还是下滚动,之后设置每次滚动的高度为屏幕的高度即可.但是,虽然效果简单, ...
- spark als scala实现(二)
Vi t1.txt1,101,5.01,102,3.01,103,2.52,101,2.02,102,2.52,103,5.02,104,2.03,101,2.53,104,4.03,105,4.5 ...
- js关于new Date() 日期格式
下面是关于Date的对象 var oDay = new Date(); oDay.getYear(); //当前年份 oDay.getFullYear(); //完整的年月日(xx年,xx月,xx日) ...
- java.util.Arrays.useLegacyMergeSort=true 作用
(原) 今天看了一下现场的环境,发现有个其它部门的项目用到了这样一个参数: -Djava.util.Arrays.useLegacyMergeSort=true 于是查看了一下什么作用. 在JDK1. ...
- Quick Select算法
https://blog.csdn.net/Yaokai_AssultMaster/article/details/68878950 https://blog.csdn.net/mrbcy/artic ...
- nginx配置文件详细解读
https://m.w3cschool.cn/nginx/nginx-d1aw28wa.html ######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户 ...
- 详解Tomcat的连接数和线程池
转: https://www.cnblogs.com/kismetv/p/7806063.html#t11 前言 在使用tomcat时,经常会遇到连接数.线程数之类的配置问题,要真正理解这些概念,必须 ...
- Data Protection - how to manage expired key?(转载)
问 According to ASP.NET Key Management: Deleting a key is truly destructive behavior, and consequentl ...
- Vue (一) --- vue.js的快速入门使用
=-----------------------------------把现在的工作做好,才能幻想将来的事情,专注于眼前的事情,对于尚未发生的事情而陷入无休止的忧虑之中,对事情毫无帮助,反而为自己凭添 ...