[SOLVED] Restoring image using DD on Linux - quick question
-
Hey folks. I made an image using the dd command on my Manjaro install about a week ago. I decided today to write it to a spare SD card to make sure it works. I got some feedback in the terminal I'm not sure about and I'm hoping you can help! Details below:
[me@me-pc ~]$ sudo dd if=/home/me/Retropie/Retropie_Backup.img of=/dev/sdb [sudo] password for me: dd: writing to '/dev/sdb': No space left on device 124735489+0 records in 124735488+0 records out 63864569856 bytes (64 GB, 59 GiB) copied, 15042 s, 4.2 MB/s
I was a bit concerned about the "records in" and "records out" bit being a single digit out, and the "no space left on device" message too. Does it look like it's worked to you?
I'm not really experienced enough with dd, so whatever knowledge you can impart is very much appreciated. Many thanks.
-
Lol, answering my own question. No it hasn't worked. "Could not mount device". In KDE:
An error occurred while accessing 'retropie', the system responded: The requested operation has failed: Error mounting /dev/sdb2 at /run/media/me/retropie: wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error
Back to the drawing board!
-
Use pishrink on the
.img
file before attempting to write it again, that might get around the small difference in bytes. -
Thanks for replying. I tried PiShrink as you say but it seems to hang on a black screen on reboot. I imagine it takes time to expand the filesystem, but it seemed to complete that (though I note no messages while it does), and it then went to the splash screen. But then...nothing! Is this a common problem? Many thanks.
-
@Ranma Without an actual error, there's not much to diagnose. Maybe disable the splash on the shrinked image and you can see if there are any errors displayed.
-
Use kpartx to mount the image (easier than doing it manually working out partition offsets). Then tune2fs and shrink the ext4 partition. Then unmount, and write it. Can't give instructions as on phone. But should work.
[Edit] you probably need to shrink the partition after also with parted.
-
Thanks for the replies folks. Turns out the whole black screen thing on reboot is me being impatient while it restores the space on the new SD card.
I tried it all again from scratch with Pishrink, only this time left it for about 20 minutes after the splash screen then black screen thing. It went to the black screen as before but I decided to be patient this time and after about 20 mins or so it rebooted itself into Emulationstation as it should. Everything seems to be running absolutely fine. Thrilled to bits! Really wanted to keep this image as I'd put a lot of weekends into it!
Thanks again. :-)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.