问题描述

系统的服务无法正常运行,查看磁盘空间,发现根目录已经满了

解决过程

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

lvm命令

Linux系统扩容根目录磁盘空间的操作方法的更多相关文章

  1. Linux系统扩容根目录磁盘空间

    作者:非法小恋 一.使用背景 Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘,但是发现系统里的大小还是没改变. 产生的原因是没有给磁盘格式化,没有增加分区. 二. ...

  2. VMware 虚拟机(linux)增加根目录磁盘空间 转自

    转自 http://wenku.baidu.com/link?url=WZDgESO0oXqYfhPYOWFalZsMglS0HKtLw7t6ICRs_sJ_sfPc85RpxsqKMwqSniis0 ...

  3. VMware 虚拟机(linux)增加根目录磁盘空间

    今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录使用率已达到80%,导致系统运行很慢.我用以下方法扩大根目录磁 ...

  4. 【重新挂载磁盘空间】Linux系统/home的磁盘空间重新挂载给/root

    以下是在centos7版本上做测试 使用如下命令查看磁盘使用情况 ls -lh 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9 ...

  5. linux 系统扩容 VMware Centos---VMware ESXi

    用到的命令 df  fdisk  pvcreate   pvdisplay    vgdisplay    vgextend    lvdisplay    lvextend  resize2fs 0 ...

  6. VMware 虚拟机(linux)增加根目录磁盘空间

    VMware 虚拟机(linux)增加根目录磁盘空间     今天查看学校的监控报修系统,不能访问了!!!系统运行很慢,用top命令查看发现内存使用率90%,用"df -h ”查看“/”目录 ...

  7. 解决Linux下pcieport 0000:00:1c.5问题导致的系统根目录/磁盘空间不足

    最近刚换了笔记本,拿到本后在win10基础装上Ubuntu 16.04双系统,有个问题是每次关机都会报一堆pcie问题,并且经常没声音,声音问题通过上一篇文章暂时解决,然后就没在意了,可是几天后出现系 ...

  8. Linux学习之CentOS(十七)-----释放 Linux 系统预留的硬盘空间 与Linux磁盘空间被未知资源耗尽 (转)

    释放 Linux 系统预留的硬盘空间  大多数文件系统都会保留一部分空间留作紧急情况时用(比如硬盘空间满了),这样能保证有些关键应用(比如数据库)在硬盘满的时候有点余地,不致于马上就 crash,给监 ...

  9. Linux Shell之监测磁盘空间

    Linux Shell之监测磁盘空间 系统管理员的另一个重要任务就是监测系统磁盘的使用情况.不管运行的是简单Linux台式机还是大型的Linux服务器,我们都要知道还有多少空间可以留给应用程序.事实上 ...

随机推荐

  1. (办公)mysql安装完,只能通过localhost访问,而不能通过本机ip访问.(转)

    GRANT ALL PRIVILEGES ON *.* TO '; 这里面*.*代表是所有库.所有表,root是用户名,%代表所有ip都可访问,也可指定ip访问,例如'root'@'172.17.5. ...

  2. Python3 小技巧

    完全个人总接 每个文件头部都可以加入这个,或者放到用单独一个文件,再import *.其实都一样,只需要一行false=False;true=True;none=null=None;hid=lambd ...

  3. .Net Core3 新特性/新功能 16条

    .net core 3实现了.net 标准2.1. 1.生成可执行文件 以前版本需要dotnet run运行项目,.net core 3支持直接生成目标平台的可执行文件.比如windows就是exe了 ...

  4. hbase 过滤器 rowfilter

    HBase为筛选数据提供了一组过滤器,通过这个过滤器可以在HBase中的数据的多个维度(行,列,数据版本)上进行对数据的筛选操作,也就是说过滤器最终能够筛选的数据能够细化到具体的一个存储单元格上(由行 ...

  5. python字典结构化数据

    https://www.cnblogs.com/evablogs/p/6692947.html dict: 键-值(key-value)对集合{key:value},查找速度极快,但浪费内存. 1 2 ...

  6. 在原有数据库中使用 CodeFirst

    一.为当前实体模型启用数据迁移 1.Enable-Migrations -ContextTypeName EME.DBHelper.StoreContext(数据访问上下文) 2. Add-Migra ...

  7. ORM初探(一)

    Object Relational Mapping(ORM): 对象关系映射(Object Relational Mapping,简称ORM)模式是一种为了解决面向对象与关系数据库存在的互不匹配的现象 ...

  8. SQL server 2017使用教程

    1.安装: 从https://www.microsoft.com/en-us/sql-server/sql-server-downloads官网下载sql server2017试用版 180天 安装完 ...

  9. python不能调试的原因

    最近有一个python项目,打开项目不能登录,想调试一下看看为什么,发现不能调试了,郁闷了,搞了半天,发现是进程里有多个python.exe,结束掉就好了.

  10. C# -- 泛型的使用

    C# -- 泛型的使用 1. 使用泛型 class Program { static void Main(string[] args) { ; string str = "Hello&quo ...