8

I have just flashed an image of my original 16 GB SD card (the one that comes in the Raspberry Pi kit) to a new 128 GB card. It booted up fine but when I tried to expand the filesystem using raspi-config it gave me

Your partition layout is not currently supported by this tool.
You are probably using NOOBS, in which case
your root filesystem is already expanded anyway.

I've seen that you can do this manually but all the tutorials I try have been for the RPi 2 or 3 and my partitions have been different to the tutorial. I can't figure out how to do it for the RPi 4. Please help.

Edit: output of sudo fdisk -l /dev/mmcblk0:

Disk /dev/mmcblk0: 119.1 GiB, 127865454592 bytes, 249737216 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: 0x000895ae

Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 4615234 4607043 2.2G e W95 FAT16 (LBA) /dev/mmcblk0p2 4615235 31116287 26501053 12.7G 5 Extended /dev/mmcblk0p5 4620288 4685821 65534 32M 83 Linux /dev/mmcblk0p6 4685824 5210109 524286 256M c W95 FAT32 (LBA) /dev/mmcblk0p7 5210112 31116287 25906176 12.4G 83 Linux

Glorfindel
  • 620
  • 1
  • 9
  • 16
Jack3G
  • 91
  • 1
  • 1
  • 5

4 Answers4

3

From the additional information you posted it appears you are using NOOBS (as the error message suggested).

I don't know why the Foundation continues to recommend NOOBS - the experienced users on this site don't use it - even on the Foundation Forum experienced users advise against using NOOBS, because it just makes everything more difficult.

You have 3 options

  1. Perform a new clean installation.
  2. Convert the NOOBS installation to a normal Raspbian image.
  3. Manually expand the extended partition then the Raspbian root partition.

2 requires some Linux expertise, but you should be able to find instructions.

Backup/Shrink the image of my working Raspbian SD Card will create an installable image, but will NEED changes to etc/fstab and cmdline.txt to match the PARTUUID (which will be the Disk identifier with "-02" appended) of the target.
sudo fdisk -l /dev/sda | grep "Disk identifier" will show the Disk identifier of a SD Card in sda

3 is comparatively simple, but requires a Linux computer (which can be the Pi with the new card in a SD reader).

It may be possible to expand the extended partition on Raspbian if you install gparted then resize the Raspbian root partition

It is possible that you could expand the extended partition on Windows then expand the Raspbian root partition on the Pi itself.

You could try the SD Card Copier on the Pi (which requires a SD reader).

Milliways
  • 62,573
  • 32
  • 113
  • 225
3

It is doable without a third-party computer, but is tricky. Back-up first.

You can resize the partitions with fdisk alone, by deleting them and recreating them at exactly the right locations. Write down the start and end sectors of each partition, as you have in the output of fdisk above. Then run sudo fdisk /dev/mmcblk0, and inside the fdisk prompt, run the following commands:

  • delete partition 2 (d, 2)
  • recreate partition 2 (n, choose extended,USE THE SAME START SECTOR, use the default for the end sector (which should be much larger)),
  • recreate partition 5 and 6 (n, USE THE SAME START AND END SECTORS)
  • change the type of partition 6 to c (t, 6, c)
  • recreate partition 7 (n, USE THE SAME START SECTOR, leave the default for the end sector)
  • print the table (p) and verify that everything matches with what you had before, except the end sectors (and sector counts) of partitions 2 and 7 should be much larger. If you notice any error, abort by entering q.
  • commit the writes to disk (w).

back at the shell:

  • run sudo partx to inform the kernel about the new layout. Alternatively, it may be safer to just reboot and check everything boots OK.
  • run sudo resize2fs /dev/mmcblk0p7 to attempt an online fs resize.

If everything went OK, you should see more space available in df.

b0fh
  • 131
  • 3
1

The easiest would be to connect SD card to PC and use GParted to extend the partition. That's one of easiest solutions available.

pbies
  • 298
  • 5
  • 14
0

Repeat the backup using one of the supported tools (which DO NOT include Win32DiskImager) and try again. Alternatively use SD Card Copier

See Periodic backup of Rpi3 Stretch SD card for a discussion of methods.

Milliways
  • 62,573
  • 32
  • 113
  • 225