It appears that the sfdisk output may have changes introducing space …#8
It appears that the sfdisk output may have changes introducing space …#8mkomarsr wants to merge 2 commits intoSpoddyCoder:masterfrom
Conversation
…padding for cosmetic purposes. This appears to have broken the subsequent 'sed' call to get the sectors. This change should work with or without the padding.
|
@SpoddyCoder - Have you had a chance to review? I've tested these changes against same size, smaller and larger SD cards and all worked as expected. |
|
@mkomarsr in the middle of testing now :) Should have an update for you later this evening. |
|
@mkomarsr - firstly, thanks very much for reporting, chasing up and contributing to the resolution. On the latest Rasbian Buster I can recreate the issue on cloning to a smaller card. Testing the PR here didn't resolve for me, clonepi output below. It looks like you may be running a NOOBS build atm? I'm running a standard 2 partition Raspbian Lite. ClonePi currently works with both (& in theory supports an arbitrary number of partitions) - so your approach would need more dynamic handling of the partitions inside the initDest() function. I'll add some annotations to the PR for you to check out. Your approach may still be a winner - but I'm going to investigate the root cause in the original code over the next couple of days. |
|
|
||
| initDest() | ||
| { | ||
| sfdisk --delete /dev/$DEST_DISK |
There was a problem hiding this comment.
| sfdisk --delete /dev/$DEST_DISK | |
| sfdisk --delete $DEST_DISK |
$DEST_DISK contains /dev/ already
| echo -e "size=+63M, type=e\ntype=5\nsize=+32M,type=83\nsize=+256M,type=c\ntype=83"| sfdisk $DEST_DISK | ||
| partprobe | ||
| mkfs.vfat ${DEST_DISK}1 | ||
| mkfs -t ext4 -F ${DEST_DISK}5 |
There was a problem hiding this comment.
This assumes there is a partition 5 - won't be the case for a vanilla Raspbian install (2 partitions).
| initDest() | ||
| { | ||
| sfdisk --delete /dev/$DEST_DISK | ||
| echo -e "size=+63M, type=e\ntype=5\nsize=+32M,type=83\nsize=+256M,type=c\ntype=83"| sfdisk $DEST_DISK |
There was a problem hiding this comment.
This is very specific structure, that matches your current install & will likely match most with NOOBS, but won't match many others.
This is the real reason ClonePi currently does a partial dd to copy the MBR - there's a lot of ways to setup a system at the partition level.
|
Yeah, my entire thought process was in replicating NOOBS images. The problem with a more dynamic partitioning is in determining which partition(s) to resize based on the dest disk size. Maybe the answer is to resize them all relative to the percentage of the original disk that each one is using. |
|
I haven't taken the time to roll back and investigate ... but my gut says the root problem here has to do with the parsing of the output from fdisk/sfdisk/something else and that output changing between versions and thus the pattern matching no longer matches. That's pretty much entirely based on the one pattern match that I fixed. Either the resizing NEVER worked (which I find unlikely) or the output changed such that it broke. |
…padding for cosmetic purposes. This appears to have broken the subsequent 'sed' call to get the sectors. This change should work with or without the padding.