RPi OS SD card Size and backups

This topic is a heads up from a lesson I have learned in the last week or so. I ordered two x SD cards with NOOBS when I also purchased the RPi 4. 1 x 16GB and 1 x 32 GB. I live on a boat and do not have regular access to the web (mobile phone only) or shops (reasoning behind 2 copies).

I am building a data management server with NMEA 2000, (including navigation, track and AIS) and Victron Energy electrical data intending to be stored and distributed for use by iOS devices. So I had imagined that the larger card might be needed.

A week later I was part way through some of the build aspects and had made some major changes to the OS/configuration of the RPi (ie. added Python libraries etc) and decided to do a backup and image copy. This ‘challenge’ is what prompted this piece of advice (mainly for newbies like myself).

ADVICE.
Always have a spare SD card of the same size as the one you intend to back up as almost (if not all) ‘standard’ approaches to cloning or imaging an SD card will make a ‘copy’ of the same size as the whole disk not just the ‘used’ data component. I had at some time in the whole process always been backing up images from the 16GB to the 32 GB one so did not come across this ‘problem’ earlier but at some time I must have swapped them (16GB vis 32GB) around.

Getting into the command line field of trying to ‘shrink’ the image so that it would only be the size of the ‘actual data used’ space which then be ‘cloned’ was unnecessarily was stressful. [Post Ed due to some feedback: let me explain further; I had read extensively the various options and ways to shrink the image - to my current understanding they ALL involved CL (command line) process. I tried a couple but none of the ones that were relevant to my situations had any ‘examples’ in their ‘helpful’ code. The authors are undoubtedly far more experienced than I; perhaps too experienced that they have forgotten what a wide variety of interpretations are in the mind of the total novice. So I copied EXACTLY the command string from one and hit enter. I started breathing a few minutes later - you ask why. Remember: I am on a MAC OS which has almost identical OS and operates on most of the CL instructions that the RPi does… cost me earlier not being clear which device (MAC or RPi) but nothing destructive. I also only have ONE 32GB RPiOS image with about 30 hours of work in total which I am trying to shrink. Go count the number of cautions on the web about how it doesn’t always work and that a ‘backup’ should be had before trying this… how. I have a copy of the files but this is not a bootable drive and I am yet to understand how to achieve this. Tried a few times with different variations but no luck. I am now embarking on a CL instruction that to me does not seem ‘right’. i.e. no ‘identity’ or point to which is the ‘target’ SD card for this instruction (AAto my MAC OS drive). Anyway I hit enter and after several seconds get another prompt ‘>’ and nothing further; I wait and I wait. Finally CTRL C out and back to my normal Mac Terminal CL prompt. My MAC (with all sorts of s/w installed -240 GB worth) is at risk; and whilst all backed up this is a weeks worth of hard work just to reinstate if I blow this instruction.

So I repeat my original question: If there is a ‘GUI’ (NOT cl] way to shrink images on SD cards…]

If anyone has a ‘clean’ and stable way of using a ‘gui’ to make a bootable image of your RPi4 image from a larger SD card to a smaller one please drop a line here - it will come in handy I am sure. Judging by all the ‘puff and splutter’ on the various forums etc. this is definitely an opportunity for someone with far better skills than I go create a program - say in Python for cross platform options - to perform this function.

Adding to this perhaps from an experienced operator - how do you go about (headless perhaps with MacBook e.g.) keep your current ‘boot’ image backed up so that if you next ‘operation’/update/configuration or whatever, goes south you can simply bring in the spare, make a copy and go from there.

Checkout pishrink

And just use Win32DiskImager

Thanks Drewsif/PiShrink. Your ‘command line’ process was exactly the one I was referring to. Perhaps you could add some ‘examples’ for what the real instruction might look like. ie. The commands are exactly the same with the exception of the [ ] around the ‘target’. Is there absolutely nothing else that changes in the real scenario. I suspect, perhaps incorrectly, that you are making assumptions as to what I would interpret and ‘modify’ for my circumstance vis-a-vis just robotically copying to my terminal and hitting enter (on My MAC terminal). Not sure of the reference to Win32 but I am assuming that you are not suggesting that I install and run ‘CrossOver’ to run a Windows program on MAC OS 11.1 and then have to go to cmd line in any case??? See my [Post ED] above and perhaps you can use your talent to answer my suggestion. Thanks for the feedback.

Hey Mike,

You may be better off running this in a virtual machine with the latest version of Ubuntu or another Linux OS. PiShrinks docs seem to cover the process very well from start to finish, the errors you may catch and how to fix them. I’d recommend Virtual Box for free and easy emulation software

https://www.virtualbox.org/

2 Likes

Try something like ‘gparted’, GParted Alternatives for Mac | AlternativeTo

2 Likes

Thanks all for the replies. Further investigation in detail however shows me the following (collectively); not for macOS 11 (up to 10.xx); only on Windows, none that I could find offer to ‘leave’ the existing data in tact,. i.e. see above that this is a ‘master’ sd card; it contains unrecoverable data (well it is backed up but not in a bootable form), finally the free versions actually do not include any of the ‘partition’ resizing type actions (for that approx $30.00). Free usually only applies to the ‘recovery’ part of their spec.

Have resolved… bought some new 16GB sd cards; downloaded the thinner version of RPiOS; updated and off to a flying start within 30 minutes (excluding the cost of the two new sd cards and the b/w required for the 1.xx gb of new RPi OS.

1 Like