hsm
Posts: 1
Joined: Tue Mar 30, 2021 9:00 pm

Extend root partition under noobs

Tue Mar 30, 2021 9:06 pm

Dear forum members,

I want to extend my root partition but I have installed my raspian with noobs so raspi-config extension method does not help.

This is my df -h output:
Filesystem Size Used Avail Use% Mounted on
/dev/root 12G 11G 201M 99% /
devtmpfs 404M 0 404M 0% /dev
tmpfs 437M 0 437M 0% /dev/shm
tmpfs 437M 12M 425M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 437M 0 437M 0% /sys/fs/cgroup
/dev/mmcblk0p6 253M 48M 205M 19% /boot
tmpfs 88M 0 88M 0% /run/user/1000

and this is sudo fdisk /dev/mmcblk0 output:
Disk /dev/mmcblk0: 29.6 GiB, 31719424000 bytes, 61952000 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: 0xea7d04d6

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 4976562 4974515 2.4G e W95 FAT16 (LBA)
/dev/mmcblk0p2 4976563 30375935 25399373 12.1G 5 Extended
/dev/mmcblk0p5 4980736 5046269 65534 32M 83 Linux
/dev/mmcblk0p6 5046272 5570557 524286 256M c W95 FAT32 (LBA)
/dev/mmcblk0p7 5570560 30375935 24805376 11.8G 83 Linux


How can I extend my root partition without losing any data? Thanks!

User avatar
procount
Posts: 2510
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Extend root partition under noobs

Wed Mar 31, 2021 4:34 pm

Your SD card is full.
Your best bet would be to get a bigger SD card (e.g. 32GB) and use SD card Copier in the Raspberry Pi OS menu to copy your old card to your new card using a USB SD Card adaptor.

It looks like you have a 16GB SD card and you installed full NOOBS on it. This takes up 2.4GB for the compressed installation files of Raspberry Pi OS and LibreELEC. If you had installed NOOBS-lite and installed Raspberry Pi OS from the internet instead, you could have gained an extra ~2GB.

You could delete these compressed installation files, and then use GParted to resize your partitions, but It's a lot of effort for little gain. Moving partitions and resizing them will take a long time on a Pi.

When you install (almost) any OS with NOOBS, it already makes your root partition as large as possible, which is why the raspi-config won't help - it can't expand what is already fully expanded. Your root partition is 12GB in size and 11GB is already used.

So you could gain a little extra space , but I would recommend a bigger SD card. You can never have too much drive space.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
rpdom
Posts: 18696
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Extend root partition under noobs

Wed Mar 31, 2021 6:07 pm

procount wrote:
Wed Mar 31, 2021 4:34 pm
It looks like you have a 16GB SD card
The fdisk output shows a 32GB card (or near enough)
hsm wrote:
Tue Mar 30, 2021 9:06 pm
Disk /dev/mmcblk0: 29.6 GiB, 31719424000 bytes, 61952000 sectors
So, perhaps this can be expanded using "sudo gparted"?
Unreadable squiggle

User avatar
procount
Posts: 2510
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Extend root partition under noobs

Wed Mar 31, 2021 8:33 pm

So it does!
Sorry, I obviously didn't look closely enough.
Maybe it was a 16GB card that was cloned to a 32GB card :man_shrugging:
In which case Gparted could be used to expand the extended partition (part 2), expand the root partition (part7) and then resize the rootfs.
But I think SD Card Copier would have been an easier way to clone the 16GB card in the first place to avoid that.

Of course, hsm should have upgraded to PINN in the first place for its cloning, backup and restore functionality. ;)
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Return to “Troubleshooting”