Score:0

Backing up Ubuntu Server 20.04.02 LTS image to SD card

tm flag

I have an Ubuntu 20.04.2 image on a Raspberry Pi that I've been trying to back up onto an SD card for over a week now. I can successfully copy the image onto my desktop with the following use of dd:

sudo dd if=/dev/sda of=UbuntuRPiImage.img bs=4M status=progress

This image is valid and I am able to mount both the system-boot and writable partitions just fine with mount. However, when I write this image to the SD card, the writable partition cannot be mounted. Here is how I'm writing to the SD card using the backup image I have on my desktop:

sudo dd if=UbuntuRPiImage.img of=/dev/sda bs=4M status=progress

I get the following error when putting in the SD card with the image:

mount: /dev/sda2: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

This also happens even when I write /dev/zero to the SD card first to completely clear it before copying the OS image to it. Important to note that the SD card itself is in good condition and I don't experience problems with it. What's going on with the writable partition that's stopping it from being mounted when put on the SD card?

The brand and model of SD cards used for both the existing Pi image and the backup image are identical.

france1 avatar
ng flag
Is the image valid too?
sudodus avatar
jp flag
1. When cloning it is important that the target drive is at least as big as the source drive, not one single byte smaller, and SD cards with the same nominal size can have slightly different sizes; 2. Furthermore, when there is a GUID partition table, GPT, and the target size is bigger, you must repair the backup partition table at the tail end of the drive. You can do this with `gdisk`. It is done automatically, if you clone from the image to the drive with [mkusb](https://help.ubuntu.com/community/mkusb).
ausername1122 avatar
tm flag
It looks like the SD card I'm cloning to is smaller than the OS image. Do I have no choice but to use another card?
sudodus avatar
jp flag
You can use some other backup method (not cloning), but the easy solution is to get a card that is big enough.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.