Linux给根目录扩容

news/2024/10/22 21:38:12/

需求: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

http://www.ppmy.cn/news/1225709.html

相关文章

[Docker]记一次使用jenkins将镜像文件推送到Harbor遇到的问题

系统版本: Ubuntu 18.01 私服: Harbor Docker版本: Docker version 18.09.5 首先需要明确的是,即在harbor里项目设置为公开,但是在push的时候还是需要用户验证的,即需要使用docker登录 docker login harbo…

常见的数据结构有哪些?

数据结构分为逻辑结构和物理结构。 逻辑结构:指数据元素之间逻辑关系的数据结构,这里的逻辑关系是指数据元素之间的前后间关系,与数据在计算机中的存储位置无关。物理结构:指数据的逻辑结构在计算机存储空间中的存放形式称为数据…

第六章SELinux

1.概述 1.1.概念 SELinux(Security-Enhanced Linux)是美国国家安全局在 Linux 开源社区的帮助下开发的-个强制访问控制(MAC,Mandatory Access Control)的安全子系统,用于各个服务进程都受到约束,使其仅获取到本应获取的资源 例如&am…

『 MySQL数据库 』数据库之表的约束

文章目录 前言 💻空属性约束(非空约束) 🔖default约束(默认值约束,缺省) 🔖列描述comment 🔖数字类型长度zerofill 🔖主键primary key 🔖📍 追加主键 📍📍 删除主键 &…

Nginx负载均衡机制及常见问题

介绍 Nginx是目前主流的WEB服务器发布软件,不仅可以作为强大的web服务器,也可以作为一个反向代理服务器,而且nginx还可以按照调度规则实现动静分离,可以按照轮询、ip_hash、URL哈希、权重等多种方式对后端服务器做负载均衡&#…

Unity 6 是下一个 LTS 版本即将发布

Unity 公司宣布,即将发布 Unity 6,并表示其为下一个长期支持版本 (LTS)。 Unity 在大会上演示了全新的 Unity 6引擎,并通过 Syncy Studios 采用 Unity 6 制作的《幻想王国(Fantasy Kingdom)》Demo 进行了演示&#xff…

中国净初级生产力年度合成产品NPP(MYD17A3H.006)

中国净初级生产力年度合成产品NPP(MYD17A3H.006)由航天宏图实验室提供,根据NASA MODIS数据(MYD17A3H.006)通过航天宏图 Smoother计算得到的平滑后NPP产品,解决了影像云雾覆盖、像元异常值等问题。对处理后的…

微服务测试怎么做

开发团队越来越多地选择微服务架构而不是单体结构,以提高应用程序的敏捷性、可扩展性和可维护性。随着决定切换到模块化软件架构——其中每个服务都是一个独立的单元,具有自己的逻辑和数据库,通过 API 与其他单元通信——需要新的测试策略和新…