Score:0

I think I wrote on my boot partition with dd - can I restore it?

kr flag

Today I tried to make an copy of a Micro SD card to another on Ubuntu 20.04. I used dd to first write an image of the first SD card to my hard drive, then switched SD cards and wrote the image from my hard drive to the new card. However it seems I was careless, at some point during the dd operation my screen went black. I suspect that I did not copy to and from the SD cards at all, but copied my boot hard drive to my storage hard drive. The boot drive is 256 GB like the SD cards, so I may have mixed them up, and in the second step copied that image from my storage drive to my boot drive while the machine was running. Rebooting got me stuck in initramfs. I booted from a USB stick to Ubuntu now and ran sudo fschk -f on the boot drive. The result contains:

Superblock invalid, trying backup blocks...
Bad magic number in super-block while trying to open /dev/nvme0n1
[...]
Found a dos partition table in /dev/nvme0n1

So is the boot sector toast here? On my storage drive I still have the image file of the first dd, presumably a copy of the boot drive. If it is indeed a copy of the boot drive, could it work to copy it back to the boot drive with dd? If not what steps should I take?

kanehekili avatar
zw flag
dd is final. I do not know of any restoration mechanism. That's what makes dd so dangerous
smcs avatar
kr flag
I wrote the image of the disk back to the disc with dd but I still ran into `initramfs` when trying to boot it. Sigh. But I was able to reinstall Ubuntu
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.