How can I resize the root partition on a Raspberry Pi 3 B+

asked 2018-06-14 17:10:48 -0500

nat_g gravatar image

I am using a 32 GB micro SD card and I tried the following instructions:

Resize after initial-setup

The other mechanism for doing it is once you've booted the Raspberry Pi and completed the initial setup to create accounts.

enlarge the 4th partition (this example uses mmcblk0)

growpart /dev/mmcblk0 4

grow the fileystem to fill the available space

resize2fs /dev/mmcblk0p4

resize root partition for the server image (which uses xfs)

xfs_growfs -d /

The first command worked, but commands 2 and 3 above fail with the resize2fs one failing with "Device or resource busy while trying to open /dev/mmcblk0p3. Couldn't find valid filesystem superblock. The xfs_growfs fails with error: data size unchanged, skipping. I understand that the 3rd command needs the 2nd to succeed to be able to work. In my case it's partition 3 instead of 4. Now the results of ab "fdisk -l" command shows:

/dev/mmcblk0p3 with a 28.3 G size, but /dev/mapper/fedora-root is still only 5.1 GiB.

edit retag flag offensive close merge delete


Is it mounted?

abadrinath gravatar imageabadrinath ( 2018-06-14 22:38:34 -0500 )edit

I'm also trying to resize the root partition of a 32 GB memory card used in a Raspberry Pi 3 B+. Here is what "print" shows in parted:

Number Start End Size Type File system Flags 1 1039kB 211MB 210MB primary fat16 boot 2 211MB 1285MB 1074MB primary ext4
3 1285MB 31.7GB 30.4GB primary lvm

I used parted in the computer that I manually use the "dd" command to copy the image to the card and resized the 3rd partition to most of the remaining disk's space. / has 5.1G

nat_g gravatar imagenat_g ( 2018-07-24 12:49:26 -0500 )edit

I don't have a 4th partition and resizing the 3rd partition to most of the rest of the disk still gives me only 5.1 GB on the root partition. Do I need to mount a 4th partition before doing the resizing? And why don't I see a 3rd or a 4th partition using parted?

nat_g gravatar imagenat_g ( 2018-07-24 12:55:56 -0500 )edit

I have worked more on this problem and I can't figure it out. The root partition is on partition 3 and it has a volume group called "fedora" that is 5.80 GB in size and I can't figure out how to make it bigger. There are 22.5 GB of unused space. The "fedora" group has two logical volumes in it: a <5.10 GB "root" and a 720 MB "swap". I have tried parted, gparted, and fdisk and I can't figure out how to enlarge the "root" volume. I have tried to do it with it booted on the Pi and also in a notebook computer with a micro SD card slot. Please how can I make the root volume bigger?

natgarrison gravatar imagenatgarrison ( 2018-08-01 10:47:18 -0500 )edit