Restoring a .img on Linux

Author
Discussion

Output Flange

Original Poster:

16,857 posts

217 months

Thursday 30th June 2022
quotequote all
I'm trying to help someone get out of a pickle.

They've got a Linux server (will need to check which version) that they've goosed, and need to restore from a .IMG file. That was a snapshot created by the Hetzner backup solution.

I'm assuming that I need to copy the .IMG file onto the server, but then how do I go about restoring from it? Internet suggests using Gnome.

Any guidance appreciated!

somouk

1,425 posts

204 months

Thursday 30th June 2022
quotequote all
Gnome bootable image and using the disk tools to restore the img to the disk in the server is going to be the recommended approach.

Does the software not have a restore option?

Output Flange

Original Poster:

16,857 posts

217 months

Thursday 30th June 2022
quotequote all
It’s a hosted server, and the backup solution is an add-on to it. There’s no access to the backup server itself, just a web interface to create snapshots which then have to be downloaded by FTP.

I only have remote console access to the server - does that still work for Gnome? I can’t boot it from a USB, for example.

somouk

1,425 posts

204 months

Friday 1st July 2022
quotequote all
I suspect you are in trouble then. You can't restore the image to the disk you are on, you need a bootable image so you can mount the other disk and restore the img to it.

buggalugs

9,243 posts

243 months

Friday 1st July 2022
quotequote all
Does Hertzner not have the ability to restore their own backups? It’s kind of strange if they don’t.

somouk

1,425 posts

204 months

Sunday 3rd July 2022
quotequote all
If it’s just a web server hosting files I’d be tempted to just bust the IMG open, recover the files and restore them to a new web server.

Output Flange

Original Poster:

16,857 posts

217 months

Monday 4th July 2022
quotequote all
somouk said:
If it’s just a web server hosting files I’d be tempted to just bust the IMG open, recover the files and restore them to a new web server.
Any suggestions on why to use to open the .img?

buggalugs

9,243 posts

243 months

Monday 4th July 2022
quotequote all
If it’s just a raw image you should be able to mount it as a normal filesystem using the loop option, specifying the img file rather than a block device as usual. Specific commands are on google.

I had an idea you could restore the image using netcat | dd if the rescue environment has networking. Or scp maybe.

somouk

1,425 posts

204 months

Tuesday 5th July 2022
quotequote all
Most disk management tools will be able to open an img, there will be some available with a quick google.