当前位置:首页 > 编程笔记 > 正文
已解决

Linux给根目录扩容

来自网友在路上 11098109提问 提问时间:2023-11-18 21:35:04阅读次数: 109

最佳答案 问答题库1098位专家为你答疑解惑

需求:Linux系统挂载到根目录的磁盘空间满了,如何扩容?
一、添加磁盘并分区

[root@cdn ~]# fdisk /dev/sdbWelcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf1212eee.Command (m for help): n
Partition typep   primary (0 primary, 0 extended, 4 free)e   extended (container for logical partitions)
Select (default p):Using default response p.
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039, default 41943039): +10GCreated a new partition 1 of type 'Linux' and of size 10 GiB.Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

二、创建pv

[root@cdn ~]# pvcreate /dev/sdb1Physical volume "/dev/sdb1" successfully created.

三、将原vg扩容

[root@localhost ~]# vgextend bigcloud-enterprise-linux-for-euler /dev/sda4Volume group "bigcloud-enterprise-linux-for-euler" successfully extended

四、扩容pv

[root@localhost ~]# lvextend -L 60G /dev/bigcloud-enterprise-linux-for-euler/rootSize of logical volume bigcloud-enterprise-linux-for-euler/root changed from 20.91 GiB (5353 extents) to 60.00 GiB (15360 extents).Logical volume bigcloud-enterprise-linux-for-euler/root successfully resized.

五、格式化

[root@localhost ~]# resize2fs /dev/mapper/bigcloud--enterprise--linux--for--euler-root
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/mapper/openeuler-root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 8
The filesystem on /dev/mapper/bigcloud--enterprise--linux--for--euler-root is now 15728640 (4k) blocks long.
#使用xfs_growfs命令扩展xfs文件系统,如果是ext4文件系统,则使用resize2fs  /dev/mysql/lv_data 

六、检查

[root@localhost ~]# lsblk
查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"Linux给根目录扩容":http://eshow365.cn/6-38703-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!