Skip to content

Instantly share code, notes, and snippets.

@leifmadsen
Last active June 22, 2018 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leifmadsen/c0624f3f3ee0a43bff8a32b00ba4592c to your computer and use it in GitHub Desktop.
Save leifmadsen/c0624f3f3ee0a43bff8a32b00ba4592c to your computer and use it in GitHub Desktop.
Resize CentOS Atomic Root Disk

Resizing CentOS Atomic /dev/atomicos/root disk

I found out that the default Atomic root disk is only 3GB! That causes all sorts of problems on the master when you try to spin up more than a handful of things (you get disk pressure errors, and things end up not spinning up properly).

NOTE

You'll need to make sure you have libguestfs-xfs package installed or virt-resize won't be able to expand the XFS partition.

# install deps
yum install libguestfs-tools libguestfs-xfs -y

# check filesystem info (and validate commands run)
virt-filesystems --long -h --all -a CentOS-7-x86_64-GenericCloud.qcow2

# create new image with proper size
qemu-img create -f qcow2 CentOS-7-x86_64-GenericCloud-resized.qcow2 30G

# resize old image into new image
virt-resize --expand /dev/sda2 \
  --LV-expand /dev/atomicos/root \
  CentOS-7-x86_64-GenericCloud.qcow2 CentOS-7-x86_64-GenericCloud-resized.qcow2
  
# check image
qemu-img info CentOS-7-x86_64-GenericCloud-resized.qcow2
virt-filesystems --long -h --all -a CentOS-7-x86_64-GenericCloud-resized.qcow2

# overwrite old image
mv CentOS-7-x86_64-GenericCloud-resized.qcow2 CentOS-7-x86_64-GenericCloud.qcow2

NOTE

I was also having some issues with getting libguestfs-tools to access the image and ultimately I think it was an outdated LVM package, but I ran the following yum update commands to get things working.

yum update libvirt* lvm*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment