Resizing Root Partition on CentOS7

Issues related to applications and software problems
Post Reply
bd2gtfh
Posts: 2
Joined: 2014/10/23 17:18:58

Resizing Root Partition on CentOS7

Post by bd2gtfh » 2014/10/23 21:02:58

Hi,

I am running CentOS 7 and using the XVF filesystem type (no LVM). I thought with kernel 3.8 an higher (I am running 3.10) that I could use growpart to grow my mounted root volume on boot and not have to rely on dracut/initramfs (the packages I previously used in CentOS 6 are not available yet on CentOS 7).

I placed the growpart module in the cloud_init_modules section of cloud.cfg. I checked the logs after first boot and it attempted to run but failed.

When running grow part manually (after first boot), I get the following output.

Code: Select all

[root@playground03 cloud]# growpart /dev/vda 2
failed [pt_update:1] pt_update /dev/vda 2
partx: /dev/vda: error updating partition 2
FAILED: pt_resize failed
***** WARNING: Resize failed, attempting to revert ******
Re-reading the partition table ...
BLKRRPART: Device or resource busy
sfdisk: The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs

***** Appears to have gone OK ****
I debugged it a bit and sfdisk actually writes out the new partition information correctly but then growpart attempts to verify, gets an error that the device is busy, and then reverts the changes.

Is the right/only answer to use LVM and extend my root partition that way?

Thanks,

Scott.

Code: Select all

[root@playground03 cloud]# uname -a
Linux playground03.bo.aquto.internal 3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@playground03 cloud]# yum list "cloud*"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.es.its.nyu.edu
 * extras: centos.mirrors.tds.net
 * updates: mirrors.greenmountainaccess.net
Installed Packages
cloud-init.x86_64                                                                               0.7.5-10.el7.centos.1                                                                      @extras
cloud-utils.x86_64                                                                              0.27-20.el7.centos                                                                         @extras
cloud-utils-growpart.x86_64                                                                     0.27-20.el7.centos                                                                         @extras
[root@playground03 cloud]# 

juergh
Posts: 1
Joined: 2014/10/27 08:35:29

Re: Resizing Root Partition on CentOS7

Post by juergh » 2014/10/27 08:51:57

I thought with kernel 3.8 an higher (I am running 3.10) that I could use growpart to grow my mounted root volume on boot and not have to rely on dracut/initramfs (the packages I previously used in CentOS 6 are not available yet on CentOS 7).
Correct. cloud-initramfs-growroot is not required anymore for CentOS 7.

What does your partition layout look like and is it an MBR-style or GPT partition?
Is the right/only answer to use LVM and extend my root partition that way?
That won't help, you still need to grow the partition that contains the LVM partition. In fact it makes it more complicated since you also have to grow the logical volume in addition to the filesystem. And growpart doesn't support LVM.

...Juerg

bd2gtfh
Posts: 2
Joined: 2014/10/23 17:18:58

Re: Resizing Root Partition on CentOS7

Post by bd2gtfh » 2014/10/28 16:59:00

Thanks Juerg,

I used the default CentOS 7 installer with a custom partition layout (to remove the default LVM configuration and to get rid of swap). Looks like it came up as an MBR partition table. Here is the output of gdisk, including the partition table.

Code: Select all

[root@playground03 ~]# gdisk /dev/vda
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!
***************************************************************


Command (? for help): p
Disk /dev/vda: 52439040 sectors, 25.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D77BBE7A-BB02-449C-994A-CD9CEE1BF4A6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 52439006
Partitions will be aligned on 2048-sector boundaries
Total free space is 31469501 sectors (15.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1026047   500.0 MiB   8300  Linux filesystem
   2         1026048        20971519   9.5 GiB     8300  Linux filesystem

Command (? for help): 

Post Reply

Return to “CentOS 7 - Software Support”