alpine在线扩容系统盘(非LVM)
扩容需要用到2个命令
我们需要使用到 resize2fs
运行 apk add e2fsprogs-extra
安装
我们需要使用到 growpart
运行 apk add cloud-utils-growpart
安装
扩容前
node215:~# fdisk -l Disk /dev/sda: 500 GiB, 536870912000 bytes, 1048576000 sectors Disk model: VMware Virtual S Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xe39d441fDevice Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 616447 614400 300M 83 Linux
/dev/sda2 616448 9005055 8388608 4G 82 Linux swap / Solaris
/dev/sda3 9005056 419430399 410425344 195.7G 83 Linux
进行扩容
node215:~# growpart /dev/sda 3 #注意这里是指的sda的第3块分区,不是sda3
CHANGED: partition=3 start=9005056 old: size=410425344 end=419430399 new: size=1039570911 end=1048575966 node215:~# fdisk -l Disk /dev/sda: 500 GiB, 536870912000 bytes, 1048576000 sectors Disk model: VMware Virtual S Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xe39d441fDevice Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 616447 614400 300M 83 Linux
/dev/sda2 616448 9005055 8388608 4G 82 Linux swap / Solaris
/dev/sda3 9005056 1048575966 1039570911 495.7G 83 Linuxnode215:~# resize2fs /dev/sda3 #重新定义sda3的ext4文件系统大小
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old_desc_blocks = 25, new_desc_blocks = 62
The filesystem on /dev/sda3 is now 129946363 (4k) blocks long.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构