andredahl
Posts: 52
Joined: Mon Oct 21, 2019 2:02 pm

SD card challenge-partition.

Fri Feb 07, 2020 7:43 am

I am having a 128 Gb SD card (raspi-config made use of whole sd card) which I use in Raspberry PI4, and it works well. Photo, video, films are loaded on that SD card as well. Allwill be placed on a separate SSD disk if needed.

I usually take a backup of the sd cards when everything works ok, however there is a challenge with the 128Gb sd card due to it will require appx 128Gb on my storage device.

Challenge 1: Is it possible to f.i. use gparted and split the sd card up in partitions, where one partition (or 2 partitions) have have what RPI4 need for boot, systems and software, and one big partitions for data ?

I am thinking of having a 32 Gb partition for RPI4 prosesses and the new partition get the remaining space.

Challenge 2: Will it be possible to only take backup of the 32Gb PI4 partition(s) ?

I will have backup of the data part of the SD card on a separate SSD anyway. It is only interesting to have an image file of, in this case, the 32 Gb partition.

Anyone having a solution to these challenges?

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SD card challenge-partition.

Fri Feb 07, 2020 9:13 am

andredahl wrote:
Fri Feb 07, 2020 7:43 am
Challenge 1: Is it possible to f.i. use gparted and split the sd card up in partitions, where one partition (or 2 partitions) have have what RPI4 need for boot, systems and software, and one big partitions for data ?

I am thinking of having a 32 Gb partition for RPI4 prosesses and the new partition get the remaining space.

Challenge 2: Will it be possible to only take backup of the 32Gb PI4 partition(s) ?

I will have backup of the data part of the SD card on a separate SSD anyway. It is only interesting to have an image file of, in this case, the 32 Gb partition.

Anyone having a solution to these challenges?
Both things are possible. But resizing a 128GB SDCard is going to take a long time. Lots of hot tea needed.

1. Use gparted. Shrink the 128GB partition by 32GB. Carve out a 256MB FAT32 primary partition and a 31.75GB primary or logical partition.
1a. Tea-time. Unless you like watching paint drying.
2. Get a regular 32GB SDCard and build plain Raspbian on it.
3. Boot the 32GB card. And check that /dev/mmcblk0p2 is exactly the same size as your 31.75GB partition on the 128GB card. Note: you may want to do step#2 & #3 before doing step#1.
4. Insert the 128GB card in a USB reader
5. Unmount /dev/sda1 and /dev/sda2 if the automounter kicked in.
6. sudo dd if=/dev/mmcblk0p1 of=/dev/sda1
7. sudo dd if=/dev/mmcblk0p2 of=/dev/sda2 (or /dev/sda5 if you built is as a logical partition)
7a. Tea-time. As that copy of 32GB of stuff takes a while.
8. sudo mount /dev/sda2 /mnt && sudo mount /dev/sda1 /mnt/boot
9. sudo blkid /dev/sda (to find the PARTUUID values for step#10 & #11)
10. Update /mnt/boot/cmdline.txt with the xxxxxxxx-01 PARTUUID
11. Update /mnt/etc/fstab with the xxxxxxxx-01 and xxxxxxxx-02 PARTUUIDs
12. Unmount everything, swap cards and reboot.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

andredahl
Posts: 52
Joined: Mon Oct 21, 2019 2:02 pm

Re: SD card challenge-partition.

Fri Feb 07, 2020 11:01 am

No problem, I have plenty coffe :-)

If I understand it right, I can use my linux mint pc and use gparted there to create a 32 gb partition.

However will gparted be able to replace boot, system etc on the 32 gb sd ?

Further using win32disk imager, will I be able to take only a image of the 32gb partision and get a proper .img file ?

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SD card challenge-partition.

Fri Feb 07, 2020 12:01 pm

andredahl wrote:
Fri Feb 07, 2020 11:01 am
No problem, I have plenty coffe :-)

If I understand it right, I can use my linux mint pc and use gparted there to create a 32 gb partition.

However will gparted be able to replace boot, system etc on the 32 gb sd ?

Further using win32disk imager, will I be able to take only a image of the 32gb partision and get a proper .img file ?
Linux Mint on a laptop is an ideal system to use. You'll still need an extra SDCard (mainly as a place to store a good bootable copy of Raspbian Buster 2020-02-05).

gparted can't invent the contents of a new partition. It can resize (preserving the contents), create or delete partitions.

So using dd to lift /boot (partition 1 - 256MB) and /root (partition 2) from a plain Raspbian card is still needed. The size of /root depends on the size of the SDCard as it will be expanded to the full size of the card on first boot. Keeping an up to date plain Raspbian card as a bootable rescue system is always a good idea.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

andredahl
Posts: 52
Joined: Mon Oct 21, 2019 2:02 pm

Re: SD card challenge-partition.

Fri Feb 07, 2020 4:54 pm

I am not sure if I fully understand this. I can format the 128Gb sd card to FAT 32 again. Then flash a .img (win32imager from a 32 gb sd card) into the 128gb sd card. When booting in the PI4 i do assume it will utilize 32 gb of that card.

Then use gparted on linux mint to establish another partision for the rest of the Gb's?

The big question is: Will the new partition destroy the boot ability for the SD card ?

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

Re: SD card challenge-partition.

Fri Feb 07, 2020 5:08 pm

andredahl wrote:
Fri Feb 07, 2020 4:54 pm
I can format the 128Gb sd card to FAT 32 again. Then flash a .img (win32imager from a 32 gb sd card) into the 128gb sd card.
Yes, but you don't need to format the card in advance. Writing the image file to it will overwrite any existing formatting.
andredahl wrote:
Fri Feb 07, 2020 4:54 pm
When booting in the PI4 i do assume it will utilize 32 gb of that card.
Correct.
andredahl wrote:
Fri Feb 07, 2020 4:54 pm
Then use gparted on linux mint to establish another partision for the rest of the Gb's?
You could do that, or you could do it on the Pi. Create new partition using the rest of the unused space and format it as ext4 (or whatever).
andredahl wrote:
Fri Feb 07, 2020 4:54 pm
Will the new partition destroy the boot ability for the SD card ?
No. The Pi tries to boot from the first FAT partition it finds on the card. The image will have copied that partition from the old card.
Unreadable squiggle

User avatar
DougieLawson
Posts: 38882
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SD card challenge-partition.

Fri Feb 07, 2020 5:10 pm

You didn't make it clear that you don't want to preserve the existing contents on the SDCard.

1. Etcher Raspbian Buster 2020-02-05 on to the card, but don't boot in your RPi
2. Run gparted on Linux Mint
2a. Resize the root partition to 32GB (may need a coffee break at this point)
2b. Create partition #3 (or logical partition #5)
3. Boot in the RPi
4. Grab a coffee to celebrate a job well done.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

andredahl
Posts: 52
Joined: Mon Oct 21, 2019 2:02 pm

Re: SD card challenge-partition.

Sun Jun 28, 2020 4:07 pm

Thanks, I made it work.

Return to “Beginners”