Get another microSD Card and install rasbpian on it and the vnc viewer on it and my PC. Then I have a headless desktop for the RPI to connect and work on it with my PC. YOu have to be running on a different (third) SD Card so the copy does not fail due to “something changed” message (and then the copying aborted) which is received quite often if you are trying to copy from the currently in use SD card.
For speed I have HA running on an SSD with my RPI4 (plugged into the USB 3.0 port) and run with no sd card even in the slot. For backup I have another SSD of the same size (but a different model*, luckily) with another cable of the same type.
Then I just boot up the RPI on only the rasbpian SD card, and use VNC viewer for a desktop on the RPI, then plug in both SSD’s and use the “SD Card Copier” app to copy one SSD to the other. *The only problem with this is, if both SSD’s of mine were the same model, then they have the same name in the SD Card Copier app so I would have no way of knowing which is which!
You can do the same if you have a couple of adapters to allow you to plug the other SD cards into the USB ports.
My backup works perfectly and it is good to do it this way because there are two different partitions on the sd cards, etc. And it is easy to test by shuttong down the RPI, switch SSD’s and turn it back on to test - that has always worked perfectly.
I am sure there is a better way of doing this but that is how I do a backup from time to time. I have tried over the last cvouple of years to dop pretty funcky things while learning and have wrecked my setup several times, but have always been saved by having a recent backup…
I use Win32DiskImager. I remove the SD card from my RPi4, put it into a USB adapter, plug it into my PC and create an image file of the SD card on my PC. This image file can be written back to a new SD card. Note: the SD cards must be the same size AND you must have enough diskspace on the PC to hold the entire size for the SD card.
I have not tried to make an image of a corrupted SD card; so, I do not know if there will be a read failure when doing this.
I like this. But I have a different way (not better) because I have committed to using only SD cards. See my thought here:
@MaxK you might want to try an SSD just for fun. The whole thing runs like 10x faster. I use a Samsung T7 - it comes with a cable that fits and no additional power source is needed.
I use win32diskimager to back up the card. If you are running Google Drive on your pc, close it or win32diskimager may not start. Also click on read only allocated partitions.
Before I do that I put the card in another pi via an usb adapter so I can run gpartd and shrink the card so I’m not backing up empty stuff. You can expand it back after the back up.
This does not help me. I am able to read only in windows pc not in mac the sd card. I see files there (.dat, .dtb, overlays, etc). In win32diskimager I can not do anything. How to clone the files to another sd card?
Another option is to create a new install on a new SD card and copy the config and storage files from the old SD card over to the new install. I have not done this but there are other post on this forum that describe how to do this.
So I was able to restore ( I think). With Linux Reader I was able to open the SD card partition and find a backup. I installed fresh version and restored. Now if I connect to PI I can see that it is started but can not access with local ip, probably because it was configured with duckdns. Also through duckdns not able. Trying to figure out why.
I had read that when copying to a larger SD card, an extra step may be needed to extend the file system to utilize the full capacity of the target SD card. I would check the 128GB card to see if the full capacity is there.