Expanding root partition on SD card - when raspi-config doesn't recognise SD card format...

On my Pi 4, I installed RaspiOS from NOOBS and configured everything. I installed to the 16 GB SD card which was supplied, but there isn't much free disk space so I'd like to copy the image to a 32 GB card and use the extra

16 GB on that card as root filesystem.

Using Windows, I've copied the image from the 16 GB card to a .IMG file, and then from that .IMG file to the 32 GB card, using Win32 Disk Imager (should I be using a different tool to do this?).

The Pi boots fine. df -k shows that the root partition is still 16 GB, as I'd expect.

I run sudo raspi-config and select Advanced | Expand Filesystem - but I get an error "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".

How do I proceed from here? Will I have to start from scratch, putting NOOBS on the 32 GB card and then installing everything again. Or would a different disk imaging tool create the 32 GB card in such a way that raspi-config can expand the filesystem?

Reply to
NY
Loading thread data ...

One way that gets over the need to expand it would be to make a filesystem on /dev/mmcblk0p3 and then use that as /home. Mount the new filesystem to /mnt and then rsync -av /home/ /mnt/ Unmount and mount the new filesystem on /home to check. Then you can unmount and remove the old /home/* and remount the new one on /home/

Alternatively (assuming you have the full desktop) install gparted and use that to remove mmcblk0p3 and expand mmcblk0p2 to the fullest extent.

You can probably do it with parted from the command line - but I've never tried.

--

Chris Elvidge, England
Reply to
Chris Elvidge

And then remember to never ever use Noobs again.

Reply to
A. Dumas

I wouldn't assume noobs was the problem, it seems more likely it was the use of a 16GB card in the first place. However, I would agree that noobs is a solution looking for a problem.

--

Chris Elvidge, England
Reply to
Chris Elvidge

On Sun, 4 Oct 2020 13:56:24 +0100, "NY" declaimed the following:

On the Beagleboard forums, Win32 Disk Imager has been deprecated as a writing tool -- the preference seems to be for Balena Etcher. However, Win32 Disk Imager would still be needed to read a card and make an image.

The R-Pi foundation seems to create lots of odd partitions when using NOOBS, while Expand Filesystem likely expect to see nothing past the root file system. NOOBS does the expansion (and likely partitioning) from the FAT-only system before putting an OS into the EXTn partition.

pi@rpi3bplus-1:~$ ls -l /dev/mmc* brw-rw---- 1 root disk 179, 0 Oct 1 01:33 /dev/mmcblk0 brw-rw---- 1 root disk 179, 1 Oct 1 01:33 /dev/mmcblk0p1 brw-rw---- 1 root disk 179, 2 Oct 1 01:33 /dev/mmcblk0p2 brw-rw---- 1 root disk 179, 5 Oct 1 01:33 /dev/mmcblk0p5 brw-rw---- 1 root disk 179, 6 Oct 1 01:33 /dev/mmcblk0p6 brw-rw---- 1 root disk 179, 7 Oct 1 01:33 /dev/mmcblk0p7 pi@rpi3bplus-1:~$

pi@rpi3bplus-1:~$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 12028584 8651864 2742660 76% / devtmpfs 440756 0 440756 0% /dev tmpfs 474036 0 474036 0% /dev/shm tmpfs 474036 6368 467668 2% /run tmpfs 5120 4 5116 1% /run/lock tmpfs 474036 0 474036 0% /sys/fs/cgroup /dev/mmcblk0p6 258094 54604 203490 22% /boot tmpfs 94804 0 94804 0% /run/user/1000

So partition 6 is /boot, but what are the others? And why did it skip partitions 3 and 4?

No tool that I know of -- since they copy the partition table as-is.

I've gotten to the point of creating a shell script that installs are my standard packages, and after creating a new card using NOOBS I run that script.

pi@rpi3bplus-1:~$ cat RPi-config.sh #! /bin/sh #all RPi sudo apt-get install -y vim-gtk3 gnat gnat-gps gfortran python3-flask python3-flask-* sudo apt-get install -y ncurses ncurses-devel ncurses-base sudo apt-get install -y nginx-full gunicorn3 python3-gunicorn python3-pastedeploy python3-setproctitle fcgiwrap sudo apt-get -y install scratch3 sudo apt-get -y remove scratch mu-editor sudo pip3 install RPI.GPIO sudo pip3 install adafruit-blinka

#RPi 4 only #sudo apt-get install -y mariadb-server mariadb-client mycli dbconfig-mysql python3-mysqldb #sudo apt-cache search libncursesada*

sudo apt -y autoremove pi@rpi3bplus-1:~$

In this aspect, the Beaglebone is simpler --

debian@beaglebone:~$ df Filesystem 1K-blocks Used Available Use% Mounted on udev 218936 0 218936 0% /dev tmpfs 49500 1576 47924 4% /run /dev/mmcblk0p1 7572696 2118140 5095796 30% / tmpfs 247480 0 247480 0% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 247480 0 247480 0% /sys/fs/cgroup tmpfs 49496 0 49496 0% /run/user/1000 debian@beaglebone:~$ ls -l /dev/mmc* brw-rw---- 1 root disk 179, 0 Oct 4 10:01 /dev/mmcblk0 brw-rw---- 1 root disk 179, 1 Oct 4 10:01 /dev/mmcblk0p1 brw-rw---- 1 root disk 179, 8 Oct 4 10:23 /dev/mmcblk1 brw-rw---- 1 root disk 179, 16 Oct 4 10:23 /dev/mmcblk1boot0 brw-rw---- 1 root disk 179, 24 Oct 4 10:23 /dev/mmcblk1boot1 brw-rw---- 1 root disk 179, 9 Oct 4 10:23 /dev/mmcblk1p1 crw------- 1 root root 245, 0 Oct 4 10:23 /dev/mmcblk1rpmb debian@beaglebone:~$

Only one partition on the SD card; the mmcblk1 device is the on-board eMMC. Their install comes with a standard script to "grow" the partition and it handles single or dual partition (older OS images used a small FAT partition -- newer ones emulate that so Windows can see the "getting started" help pages).

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/
Reply to
Dennis Lee Bieber

NOOBS is OK to play with, being able to install lots of OS's and find the one you like, but then you are only going to use one OS going forward, you need to ditch it and just use a single OS install.

The problem with NOOBS is there are lots of partitions, more than the 4 which can be marked as physical, so it needs to use logical partitions. When you copy it to a new card, instead of the OS being the last physical partition which can easily be expanded by raspi-config to the size of a new card, its trapped within a logical partition and my have others after it.

You don't have to start again from scratch, it is possible to extract just your OS's boot partition and root partition, but its not straight forward, and if you haven't messed with partition tables before, it can be a bit daunting.

I'll only give a brief outline of what to do, as without I don't NOOBS card to refer to, and it was a long time since I had to do it.

1) Backup up the NOOBs card, and do this on the copy on the larger card 2) Boot in to the OS you want to use 3) Use df and note the partition numbers of /boot and / (root) 4) Put the card a different Linux machine and unmount all partitions 5) Using parted note the start and end of the two partitions above 6) You will have to delete all partitions on the card to get rid of the logical partitions 7) Recreate the partitions noted as physical partitions 8) Using gParted move boot to start 4M in to the card, with size 256M and root after boot taking up the rest of the card

---druck

Reply to
druck

Sorry for my earlier advice, then. Never used NOOBs so didn't know it had *many* partitions.

--

Chris Elvidge, England
Reply to
Chris Elvidge

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.