I need to know how to install raspi-config on a CentOS distro. Can this be done? If not, how can I manually adjust the root partition? On every image I've downloaded for the Pi, every CentOS distro, the root partition is very small after flashing the image to the SD card. I'm using a 64GB SD and the default root partition is only like 1.7GB which leaves me no room on the root for anything such as updates and server software I want to run.

I've tried to use a VM via hyper v on Windows 10 and for a minute, I thought it was going to work, everything I've tried has been unsuccessful in resizing the root partition and also producing an SD card that will actually boot on the Pi. I tried GParted live boot as well, couldn't get that to work either. I tried fdisk and parted on the cli, several times and several ways to no avail. How can this be properly achieved?

I'd prefer raspi-config as this is no doubt the easiest way to go, if there is a version that will function on CentOS.

Any help will be greatly appreciated, thanks.

  • have you booted the pi with the image and tried to expand the partition? it's pretty easy using sudo parted -m /dev/mmcblk0 u s resizepart 2 #### - where #### is one less than cat /sys/block/mmcblk0/size - I'm assuming centos has two partitions like raspberry pi OS of course
    – Bravo
    Sep 19, 2021 at 3:20
  • They offered only the minimal CentOS for the Pi4 and the way it partitions is 1 is boot, 2 very small ext4 partition, and then there is 3 which is a swap. I did boot to this drive and attempted several times using different methods , each time failed and had to re-flash the SD card every time. That takes some time, so that is when I began trying to figure out a way to put raspi-config on, but CentOS of course is a Fedora distro and Raspi is Debian. I really need the CentOS because I'm going to be using this as a temporary web server until I can fix my main server.... Sep 19, 2021 at 17:38
  • The centos image has boot on 1, swap on 2 and root on 3 - so, you can extend root without worrying about swap
    – Bravo
    Sep 20, 2021 at 0:06

2 Answers 2


Found the answer to this issue, it was not in a README file, it was in a .cfg file called anaconda-ks.cfg and for some reason I just decided to open it and look at it, and buried in that file was a note which explained that to expand the partition run the following command from the cli as root:

#: rootfs-expand

Again, if you are running Pi4 with CentOS and need to expand the size of your root, just run the simple command "rootfs-expand" and it's done.

  • This worked for me on my Raspberry Pi 3 B as well!
    – Ken
    Feb 3, 2023 at 4:04

Most Pi OS have raspi-config which includes an option to resize the filesystem.

raspi-config is just a bash script, so you can copy from Raspberry Pi OS although whether it will work depends on the OS. It is also dependent on a couple of standard tools which should be in most OS (if not installed by default).

NOTE you can not resize a mounted partition.

Failing this it can be done manually, assuming the distribution includes the necessary tools.
See https://ubuntu-mate.community/t/rasberry-pi2-file-system-resizing/2288/8

run sudo fdisk /dev/mmcblk0

Then press the keys in order:

d 2 to delete,
n p 2 Enter Enter to re-create.

Verify the prompts to make sure what you are entering is sensible.

Reboot and enter:-

sudo resize2fs /dev/mmcblk0p2

There is one thing to be wary of.
MAKE SURE the new partition STARTS on the same block!
If it tries to create a new partition in the spare 3M you will need to manually enter start block.

Running sudo fdisk -l /dev/mmcblk0 BEFORE will list existing partitions.

Disk /dev/mmcblk0: 14.5 GiB, 15523119104 bytes, 30318592 sectors
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: 0x6d9a0006

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    93814    85623 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 30318591 30224384 14.4G 83 Linux
  • CentOS is a Fedora distro, so it works a bit different than Pi OS does, as the Pi default is Debian based. The fdisk and parted commands work the same of course. The problem I had when trying to resize is the fact that there are two different partitions following the root partition, and from my understanding to resize the root partition the following partition has to have the unallocated space to do so. Sep 19, 2021 at 17:56
  • There is a small ext4 and then a swap using the image I have for the SD card. I turned the swap off, deleted both, changed fstab, formatted the space to use for resizing but when I got to the point to resize like the last step in the process, it wouldn't work, mounted, couldn't unmount. There has to be a way to do this, and while I'm not green with Linux, I'm not an expert either. Sep 19, 2021 at 17:57
  • on the image that is supported by the pi 4, the partitions are 1 - boot, 2 - swap, 3 - root ... so, you should be able to extend the root partition (partition THREE) without touching swap ... or formatting anything
    – Bravo
    Sep 20, 2021 at 0:00
  • raspi-config would be no use to you because it does what I described. As @Bravo commented this is a procedure for expanding the LAST partition. Just use the number of the LAST (unless using extended partitions). post the output of sudo fdisk /dev/mmcblk0 in your Question.
    – Milliways
    Sep 20, 2021 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.