I created a .gz archive of a disk image (Ubuntu 18.04) of one of my virtual servers with the following command:
dd if=/dev/sdb | gzip -1 - | pv | ssh user@ip dd of=/home/user/sdb.gz
While unpacking the archive I ran into the following error:
gzip: sdb.gz: unexpected end of file
As I tried to run the
.img-file on my own unraid machine as a VM, I ended up in grub. So I knew that there was probably something wrong with the image. Using ls the most important files seem to be there.
The server had a 15GB disk, but I didn't realize a part was missing since it was compressed anyway. The resulting image file is only 4.3GB.
Since then my virtual server has been deleted by my VPS-provider. Now I've realized, that the archive is not complete as it ran into a disk size limit on the receiving machine.
As the basic file structure is available and I'd naively believe that the first 4GB contained all of the VM I'd like to recover the system. The data is not to important imho, but it seemed like something useful to learn and worth a try. My suspection is that something is wrong with the partition information and that the system can't find the correct boot path for some reason.
linux /boot/vmlinuz-4.15.0-135-generic root=/dev/sda1, I receive the error:
error: attempt to read or write outside of hd1.
The correct file system for me seems to be
Therefore I used
set prefix=(hd1,1)/boot/grub beforehand.
Running the following commands
insmod linux insmod normal normal
does seem to do nothing at all.
What steps do I need to go through to get the system booting again? Can I use a ubuntu iso to repair it?
Additional Information (edit):
As said before the original VPS had a size of 15GB, the .img file i pulled out of the broken .gz archive has a size of around 4.3GB. Do I need/ am I able to increase this size with gparted or similar tools? (I'm running it on my unraid machine with above 4TBs of space, but I suspect that's not what @Bodo meant.)
Also, pulling out individual files has limited value for me. Everything really important has been backed up a long time ago, the point of this image was to be able to spin up the exact (or as close as I can get to) environment my software was running in on the rented virtual server.
Gparted (Edit 2):
I just looked into the gparted route: I received this error message:
Invalid argument during seek for read on /dev/sdb
A quick google search resulted in an entry on this page which told me that
the partition table is at the end of the disk
which is why the partition information is missing.
As the .img file is too small, i can't use the "w" command to write the changes as mentioned on the same page. I'm currently struggling to enlarge this file.