Everybody knows - by raspi-config we can expand the image to the borders of the ext4 partition of the SD-card, but shrinking is impossible.
This will generate copy problems, using a second SD-card to copy to, with labeled same size, but in reality the usable space is a bit smaller (e.g. 8Gb SD-Card 1, 7,2 GB space usable; 8GB SD-Card 2, 7,1 GB space usable)
This means, even when the used space of the larger SD Card is (much) smaller than the available space of the fresh second SD-Card, win32DiskManager will not work as it can only copy physical blocks 1:1 ...
To overcome this situation shrinking the ext4 content of SD-card 1 is a Must to succeed
How to manage this situation technically?
My idea (e.g. with the below constraints):
SD-Card 1, labeled 8 GB, real space is 7.2 GB, Raspian Image is expanded to its boarders
fresh SD-Card 2, (labeled 8GB, real space is 7.1 GB, FAT32 - empty)
Additional Linux PC (e.g. Virtual Box VM running your Linux Guest on your Host windows 10 system)
Steps:
Prepare the second (smaller) SD-card with a fresh Raspian image, boot and expand it by raspi-config to the SD-card borders.
Mount the two SD-cards into your running virtual Linux system
By File Archiving (not Partition Archiving!) "fsarchiver savedir ..." prepare a file archive from all files of the ext4 partition of the 1. (larger) SD-Card
Delete all files in the ext4 partition of the second SD-Card (e.g. by "rm -r *")
Use "fsarchiver restdir" to restore the archived ext4 files from the 1. SD-Card ext4 partition into the corresponding ext4 partition on the 2nd SD-card. As you are not copying the partition - but files, the slightly smaller ext4 partition of SD-Card 2 will now contain all ext4 files of the 1. SD-Card. The nautilus explorer confirms this!!!
Unmount your 2nd SD-Card put into your Raspberry and boot ...!
I have tried this- no chance the boot fails! This method will only work when the second SD-card provides exactly the same ext4 space as the 1 SD-Card.
I am confused now, because I had assumed that copying files (and not partitions) could resolve the win32DiskManager Block Copy issue.
What is my error, please?
Your expert explanation is pretty much appreciated.
Thanks in advance
SD Card Copier
in Raspbian to duplicate the card - this works to smaller or larger SD Cards.gparted
. It can even be done on the Pi (but not to the active partition).sd card copier
(or piclone) works as long as the destination card is big enough to hold the content of the current cardSD Card Copier
- even copying a 16GiB card to 8GiB (after deleting excess files).