当前位置: 首页 > news >正文

What is growpart utility and how to use it ?

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 10

Issue

  • How to extend a partition using thegrowpartutility online?
  • Can I extend the partition which is in-between the two partitions? - A special Case

Resolution

Disclaimer:The following information has been provided by Red Hat, but is outside the scope of the posted Service Level Agreements and support procedures (Production Support - Red Hat Customer Portal). The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. The intent of this article is to provide information to accomplish the system's needs. Use of the information in this article at the user's own risk.

From a technical point of view, resizing filesystems and their underlying partitions (making changes to the existing partition table) can be very dangerous. Also, it is only possible to resize partitions from their end position on the disk. It is not possible to move partitions on the disk or resize them from their beginning. Such operations can result in a corrupted partition table, which will render all data on the disk device inaccessible, leading to data loss. While it is possible to perform online partition resize operation, it is not recommended simply from a data integrity standpoint and not because it's not possible.

  • What isgrowpartutility?
  1. growpartis one of the utility to extend thelast partitionof the disk to fill the available free space on the disk. It changes thesector positionto the end sector of the disk.
  2. It only extends the last partition. It doesn't create or delete any existing partition.
  3. It can be runonline. Dry run test can also be done to check the same.
  • Extend the partition:

Raw

root@rhelbox ~]# growpart -v /dev/sde 1 CHANGED: partition=1 start=2048 old: size=1675264 end=1677312 new: size=4192223 end=4194271

Heregrowpart'sfirst argument is disk and second argument is partition number.

  • Verify the partition table:

Raw

[root@rhel7 test6]# parted /dev/sde u s p Model: VMware Virtual disk (scsi) Disk /dev/sde: 4194304s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 4194270s 4192223s primary
  • Once the partition has been extended,Resizethe physical volume which is using it (Only if PV exists on top of it).
  • Fromcloud-utils-growpart-0.33*on-wards, Underlying physical volume automatically gets resized once the partition is increased.

  • Can I extend the partition which is in-between the two partitions? - A SPECIAL CASE

    • Consider the following layout, where we can delete the 2nd and 3rd partition i.e. /dev/vde2 and /dev/vde3 and extend /dev/vde1 to use free space between /dev/vde1 and /dev/vde4.

Raw

vde 252:64 0 7G 0 disk ├─vde1 252:65 0 716.8M 0 part ├─vde2 252:66 0 717M 0 part ├─vde3 252:67 0 716M 0 part └─vde4 252:68 0 1.4G 0 part

Raw

(parted) p Model: Virtio Block Device (virtblk) Disk /dev/vde: 7516MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17.4kB 752MB 752MB 2 752MB 1504MB 752MB ext2 3 1504MB 2254MB 751MB ext2 4 2254MB 3758MB 1504MB ext2
  • Delete the partitions 2 and 3.

Raw

(parted) p Model: Virtio Block Device (virtblk) Disk /dev/vde: 7516MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17.4kB 752MB 752MB 2 752MB 1504MB 752MB 3 1504MB 2254MB 751MB 4 2254MB 3758MB 1504MB (parted) rm 2 (parted) rm 3 (parted) ^C Information: You may need to update /etc/fstab.
  • Now, extend the first partition /dev/vde1 upto /dev/vde4

Raw

# growpart -v /dev/vde 1 update-partition set to true FLOCK: try exec open fd 9, on failure exec exits this program FLOCK: /dev/vde: obtained exclusive lock resizing 1 on /dev/vde using resize_sfdisk_gpt 14680064 sectors of 512. total size=7516192768 bytes ## sfdisk --unit=S --dump /dev/vde label: gpt label-id: BD1F8EAF-8A66-41D6-B544-6264F2805A3E device: /dev/vde unit: sectors first-lba: 34 last-lba: 14680030 sector-size: 512 /dev/vde1 : start= 34, size= 1467973, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0A8B9462-BB70-4A2B-99F7-2BE 40602AD9C /dev/vde4 : start= 4403200, size= 2936832, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=4C8B160C-D5F3-409D-89F8-152 6F4FC42E3 max_end=4403199 tot=14680064 pt_end=1468006 pt_start=34 pt_size=1467973 resize of /dev/vde returned 0. CHANGED: partition=1 start=34 old: size=1467973 end=1468006 new: size=4403166 end=4403199 FLOCK: /dev/vde: releasing exclusive lock /dev/vde1 is not an lvm pv
  • Confirm the same.

Raw

# lsblk | grep vde vde 252:64 0 7G 0 disk ├─vde1 252:65 0 2.1G 0 part └─vde4 252:68 0 1.4G 0 part

Raw

# parted /dev/vde GNU Parted 3.5 Using /dev/vde Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p Model: Virtio Block Device (virtblk) Disk /dev/vde: 7516MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17.4kB 2254MB 2254MB 4 2254MB 3758MB 1504MB (parted)

Diagnostic Steps

  • Verifygrowpart packageis installed, If not then install:

Raw

[root@rhel7 ~]# rpm -qa| grep -i growpart [root@rhel7 ~]# yum install cloud-utils-growpart -y OR # rpm -ivh cloud-utils-growpart/path/to/rpm
  • Verify thepartitiontable using the below command before runninggrowpart:

Raw

[root@rhel7 test6]# parted /dev/sde u s p Model: VMware Virtual disk (scsi) Disk /dev/sde: 4194304s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 839679s 837632s primary
http://www.jsqmd.com/news/421643/

相关文章:

  • 2026年 塑料原料厂家推荐排行榜:塑胶原料/塑料颗粒/工程塑料/改性材料,源头实力与创新应用深度解析 - 品牌企业推荐师(官方)
  • 青岛不锈钢保温水箱哪家专业?本土品牌深度测评对比 - 中媒介
  • 2026年河北发电机租赁推荐厂家:发电机出租、发电车租赁、UPS应急电源出租 - 海棠依旧大
  • 解决数据孤岛:AI知识库在小团队的落地案例与技巧
  • 2026年 苹果舱厂家推荐排行榜:移动苹果舱,装配式苹果舱,智能苹果舱,网红创意苹果舱,全景集成与钢结构一体式设计深度解析 - 品牌企业推荐师(官方)
  • 2026年2月热门放热焊接公司推荐,这些企业值得关注!柔性石墨接地线/接地施工队伍,放热焊接销售厂家排行 - 品牌推荐师
  • 探针台在半导体测试领域的关键之处
  • 数据质量测试的核心定义与价值(10)
  • 适配半导体设备流量测量:2026值得关注的超声波流量传感器品牌推荐 - 品牌2025
  • 展厅设计公司哪家好?文化文博/智慧城市领域5家优质机构推荐 - 深度智识库
  • 20260228 模拟测 总结
  • 某园区网DNS劫持报告
  • 《计算机视觉:模型、学习和推理》第 16 章-多摄像机系统
  • 2026年 刀片厂家推荐排行榜:不锈钢/粉碎机/钢筋/合金/剪板机/木工/切粒机/撕碎机/中药材/食品刀片,匠心锻造,精准切割之选 - 品牌企业推荐师(官方)
  • 2026年民用微压氧舱厂家推荐排行榜:家用/康复/美容氧舱品牌深度解析与选购指南 - 品牌企业推荐师(官方)
  • 装备制造业如何运用运维管理平台实现降本增效
  • 《计算机视觉:模型、学习和推理》第 15 章-变换模型
  • 2026卫生高级职称评审题库哪个好?主流题库全面对比,科学选库不踩坑 - 医考机构品牌测评专家
  • 5篇RAC前沿论文:从医疗到区块链
  • 闲置中石化加油卡回收变现认准京顺回收 - 京顺回收
  • 半导体专用流量测量:高精度超声波流量传感器推荐 - 品牌2025
  • Gin 框架中的规范响应格式设计与实现(二十四)
  • 字节Trae ide
  • Gin 框架中的规范响应格式设计与实现(二十二)
  • Gin 框架中的规范响应格式设计与实现 (二十三)
  • Gin 框架中的规范响应格式设计与实现(二十)
  • Gin 框架中的规范响应格式设计与实现 (二十一)
  • 2026年2月折弯机订做厂家推荐,实力品牌深度解析采购无忧之选 - 品牌鉴赏师
  • 2026 英文建站优秀企业推荐|Google 建站公司实力排名新鲜出炉 - 品牌推荐大师1
  • FPGA 验证的主要工作流程和验证工具是什么?