Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Pi-Baker - Mimic Pi...
 
Share:
Notifications
Clear all

[Solved] Pi-Baker - Mimic PiShrink Functionality?

8 Posts
2 Users
0 Reactions
3,328 Views
(@ceramicmonster)
Active Member
Joined: 5 years ago
Posts: 4
Topic starter  

First time poster, so sorry if this is the wrong place. One of the issues I have is trying to copy a raspberry pi install to a smaller SD card than it was originally installed on. It's easy on Ubuntu, but in no way on Mac. I think it would be great if Pi-Baker had an option of not just compressing an image after backup, but to mimic PiShrink functionality. That way not only would the backup be smaller, but the backup created could be directly flashed without expansion to a smaller SD card than the original SD card (assuming enough room for files). Then the file system expands to the size of the new SD card automatically upon booting the Pi. 

This topic was modified 5 years ago by ceramicmonster

   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Hi Ceramicmonster,

Well, I have good news for you ... for a while already (Nov 2019), ApplePi-Baker has the option to resize Linux partitions.
During backup a Linux partition can be resized to a minimum size, keeping the backup file small.
During restore a Linux partition can be resized to fit the available space on the SD card (assuming the minimum size fits).

Resizing on Restore works for normal backups and for backups made with the shrink function of ApplePi-Baker.

 

Building this was quite a challenge, only MBR primary Linux (Ext) partitions are supported.
Other partition schemes (GUID etc) and partition types (Extended) are not supported, since this becomes exponentially more complex.
(my knowledge about the partitions and partition schemes is limited)

This has been available since 2.2.0 (if I recall correctly)  😊 

Hope this is what you're looking for! 😉 


   
ReplyQuote
(@ceramicmonster)
Active Member
Joined: 5 years ago
Posts: 4
Topic starter  

I did try to backup/compress it last night, I got an error during the compression process. I just looked it up and found 'disk2' was EXT and 'boot' is FAT32... no idea how that happened, but that sounds like the issue right there. Do you know of a way to move it to a new card with all partitions being EXT?


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Do you know what the error message was during compression?
I'd give it a try without compression.
Also watch the available disk space. In the most excessive case you'd need 2 - 3 times the size of the SD card as free space on your harddisk.

The Shrink/Expand function is based on MBR disks, which typically have the first primary partition being FAT or FAT32 and the second primary (!) partition being EXT.
In this formatting up to 4 partitions can be a primary partition. This used to be the most common way to partition SD cards for the Raspberry Pi.

Recently some have started using a different partitioning scheme (not sure why though), which will not work with the shrink/expand function.
You'd see (on an MBR disk) one FAT or FAT32 primary partition, and one Extended partition (!). The Extended partition then holding 1 or 2 logical partitions (like "sub" partitions inside the Extended partition).

Considering the info you provided, it sounds like you have the right configuration on your disk.
Naturally, "disk2" could  be a logical partition residing on an extended partition. (nice and confusing right?)

Note, do not confuse "extended" partition with "EXT formatted partition" - you probably already know this I assume, but if not: FAT/FAT32/EXT are filesystems on a partition.
Where as partitions can be "primary", "extended" or "logical".

This is how shrinking works (to give you a better idea about needed disk space - expanding a partition works in a similar way);

  1. APB makes a full IMG of the SD card on your harddisk.
  2. APB tries to determine if the is a primary partition, in the IMG file, with an EXT filesystem.
  3. If found, APB will copy that entire partition to disk.
  4. The copied partition will then be shrunk.
  5. Next APB grabs the original IMG backup, and copies all the bytes up to the EXT partition to a new IMG file.
  6. After that it will add the shrunk EXT partition to the new IMG file.
  7. And finally it will add everything beyond the EXT partition, from the original IMG backup, to the new IMG file.

As you can see: this can potentially take up quite a bit of disk space.
Unfortunately, I have not found a way to shrink or expand a partition on the fly 😞 

 


   
ReplyQuote
(@ceramicmonster)
Active Member
Joined: 5 years ago
Posts: 4
Topic starter  

Yikes, well it turns out that I bricked my Pi somehow during a sudo apt-get upgrade because even the uncompressed backup isn't booting it. Now I'm starting all over, but it's only an Octopi install, could be worse, and I start from a 32gb SD not 128 this time. Sadly I would have to take 3 hours just to grab that backup in compression mode to get the error message and I don't have the time for that. Thank you for the useful information though, and on my next backup later today, I will see if I get that error backing up the 32gb card and post it here if I do.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Yeah, tinkering with backups is very time consuming, ... I've had to do this several weeks in a row because of testing APB ... 😞 

I had to Google OctoPi haha, it's been a while that I tinkered with the RPI.

Sorry to hear you bricked you RPI though 😞 


   
ReplyQuote
(@ceramicmonster)
Active Member
Joined: 5 years ago
Posts: 4
Topic starter  

@hans Yeh it seems that when APT-GET UPGRADE is used on Octopi (when flashing it from their provided disk image) it goes berserk lol! NO idea why, no one does it seems. But now that I started from scratch again with a clean install on a smaller card, it's much better... and I really do love ApplePiBaker, definitely the best app for this   😀 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Thanks for the warning to NOT use apt-get in OctoPi 😉 

And ... glad to hear you're liking APB 😊 


   
ReplyQuote
Share: