查看linux系统增加根目录空间不足
Linux根目录磁盘空间不够用了,当修改了虚拟机模版增加磁盘大小或者插入了一块新硬盘
操作方法
1.查看磁盘空间大小,使用df -h 命令,发现挂载根目录节点的/dev/mapper/centos-root已经使用17G空间不足
2.使用fdisk -l命令查看磁盘信息
3.使用fdisk /dev/sdb, 创建新分区
[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x52b3ea6f 创建新的 DOS 磁盘标签。
命令(输入 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 (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):p
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x52b3ea6f
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 83 Linux
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
4.重启Linux操作系统,使用reboot命令。
5.创建物理卷,使用pvcreate /dev/sdb1命令。
[root@localhost ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
6.查看新建的物理卷和大小,使用pvdisplay命令
7.将添加新的物理卷,加载到centos卷组,使用vgextend centos /dev/sdb1命令
[root@localhost ~]# vgextend centos /dev/sdb1
Volume group "centos" successfully extended
8.查看卷组信息,使用vgdisplay命令
9.增加centos大小,增加19G。使用lvresize -L +19G /dev/mapper/centos-root命令。
[root@localhost ~]# lvresize -L +19G /dev/mapper/centos-root
Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to <36.00 GiB (9215 extents).
Logical volume centos/root successfully resized.
10.重新识别centos大小,使用 xfs_growfs /dev/mapper/centos-root命令。
11.查看扩容后的大小 ,使用df -h命令。
本文由 帝一博客 原创发布。用户在本站发布的原创内容(包括但不仅限于回答、文章和评论),著作权均归用户本人所有。独家文章转载,请联系邮箱:17762131@qq.com。获得授权后,须注明本文地址: https://bubukou.com/linuxyunwei/1942.html
-
一个小时学会搭建和使用 kubernetes
2021-12-07 17:36
-
linux生成公钥私钥ssh远程实现直接免密登录
2021-05-11 10:31
-
linux(centos)安装lrzsz上传下载软件rz,s...
2021-01-25 17:58
-
linux mkfs.ext4命令格式化硬盘
2021-01-15 14:54
-
查看linux系统增加根目录空间不足
2020-12-31 11:28
-
linux下如何tightvncserver安装使用图形化访...
2020-12-28 19:03
-
centos7中 yum跟python的安装【附带pytho...
2020-12-08 20:57
-
Centos 7.4系统Filebeat + Kafka +...
2020-12-07 10:45
-
CentOS 7系统搭建Rsyslog+LogAnalyze...
2020-12-03 22:12
-
linux groups命令显示指定用户帐户的组群成员身份
2020-11-29 15:52
网友留言评论