Virtualbox I/O errors

Discussions related to using VirtualBox on Linux hosts.
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

If I attached a liveCD.. and ran file systems checks might that be able to repair the damage?

CloneZilla should be able to backup my server right?

Also, if I run this from terminal I should be able to make an image of my vbox that I burn/copy/convert to a new vdi right?

run from local computer

$ ssh user@remote "dd if=/dev/sda | gzip -1 -" | dd of=image.gz
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Virtualbox I/O errors

Post by fth0 »

I expect the VDI structure to be damaged, so neither the guest OS nor the host OS can repair that. When using dd, you'll at least have to handle read errors somehow.
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

ok, after some guess work, I came up with:

#ddrescue -d /dev/sda1 /media/sf_shared_folder/tester1.iso /media/sf_shared_foldertester-dd.log

and create an iso of my data. My questions now are:

1.) what your recommended method, (most efficient way) of changing the iso to vdi, so I can get back to work?

2.) I have I have older backups of my currently corrupt vdi...rather than the above solution, how would you have used the older backups to save the data from the corrupt disk? (I am looking for specific steps, that I can use for future reference.
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

Update: I used

$VBoxManage convertdd source_file.img destination_file file.vdi

to turn my tester1.iso file into a vdi

The problem I have now is that neither.vdi or .iso will boot when I attach them to a new vbox machine.

What am I doing wrong?
Attachments
tester-dd.log
(369 Bytes) Downloaded 3 times
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Virtualbox I/O errors

Post by fth0 »

I'd suggest to create a completely new VM, including a new guest OS installation. Afterwards, you can add additional virtual disk images (e.g. from your backups or from your rescue attempts) to this VM and mount their contents inside your guest OS, if they are not damaged.
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

Quick word of advice for the novice... I created 2 backups... one of /dev/sda and one of /dev/sda1 which iso is best to use?
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Virtualbox I/O errors

Post by fth0 »

AFAIK, ddrescue does not create ISO files, even if you name the resulting file ending with .iso. First I'd try /dev/sda, which is a hard disk. /dev/sda1 is a partition on a hard disk, and you'd need an additional MBR to create a (virtual) hard disk.
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

ok... thanks for answering the "super-noob" question... just jitters, never done this before, but I do have multiple months of backups, guess I shouldn't be that nervous.. :roll:

In any case, thanks for the ddrescue tip... so I guess that my .iso is really a .img file with the wrong extension, which really isn't clear from the manual

https://www.gnu.org/software/ddrescue/m ... anual.html

I have a new, vdi with debian 10 / gnome desktop installed from their mini.iso... The mission now is to get my data from .iso on to the new vdi. I am currently converting the .img file into an actual .iso file..

Any tips?

three special things.
1. my backup still has the wrong GA installed (whoops)
2. I had a grub password on the corrupt vdi (hence the reason I also made a backup of /sda and not just sda1
3. there is a display error that prevented my corrupt vdi from actually reaching the gui login screen (I was doing everything via terminal)
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

Actually figured it... best to read the full tutorial, not just skip to examples... whoops :oops:
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

3 cheers for dumb luck!! When I couldn't convert the .img to .iso (which was a wholly unnecessary move), I came to realize that I had created the the backup incorrectly and was very lucky to not have overwritten my entire disk (disk should not be mounted when using ddrescue.. whoops).

In any case, I finally made a good back and used ddresecue to write the img to the new disk. Everything seems fine, except one problem.. networking fails during the boot and I can't ssh into the box (its the only service to fail now), and as I previously mentioned I can't reach the gui login.. (that's a problem for a different posts, unless you know a quick fix, the boot stops at "gnome display manager" and never reaches login screen, i've been using ssh and have not been concerned by it)

I double checked that the vbox manager settings for network were identical on both machines...

what can I do to get into the new machine via ssh?
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

Here's the log from the new machine
Attachments
VBox.log
(115.89 KiB) Downloaded 2 times
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

I can't ping the ip address..
I verified ufw wasn't the problem

I am guessing that there is some type of ip conflict on the host machine (ubuntu 20.04) that doesn't like 2 VMs having the same ip address?

here's my setting on the new machine
Attachments
Selection_613.png
Selection_613.png (75.73 KiB) Viewed 14936 times
Selection_614.png
Selection_614.png (75.41 KiB) Viewed 14936 times
yupthatguy
Posts: 73
Joined: 4. Jul 2015, 07:48

Re: Virtualbox I/O errors

Post by yupthatguy »

In line with my belief of "fail hard, come back stronger"... I am posting my notes on solving this problem for other "noobs" to follow:

Big thanks for all the help fellas!!


process to backup & restore a corrupt vdi (local)

1.) in vbox manager add an bootable iso disk to the corrupt vdi and boot the vdi into it (i.e. ubuntu liveCD)
2.) open the disks utility and ensure that targeted disk is not mounted (i.e. /dev/ )

3.) install vbox guest additions onto the the booted iso to gain access to shared folders (assuming shared folders already exists) and via terminal change into the shared folder

4.) install gddrescue onto the booted iso, via terminal (inside shared folder), run:

$sudo su
# ddrescue -d /dev/sda backup.img BACKUP.log
(NOTE: the logfile aka mapping file is important in case the backup process is interrupted and enables ddrescue to restart / continue the process from interruption point)

5.) Once finished, create a new vdi, install a minimal operating system (will be overwritten).

6.) in vbox manager add the bootable iso disk to the new vdi and via the disks utility verify that the new vdi's /dev/sda is NOT MOUNTED

7.) install guest additions and ddrescue again, then run:

$sudo su
#ddrescue -f /dev/sda backup.img RESTORE.log
(NOTE: the logfile aka mapping file is important in case the RESTORE process is interrupted and enables ddrescue to restart / continue the process from interruption point)

8.) Once it finishes you now have a perfect back up of the corrupted vdi, but you are NOT quite done if you use the vdi as a server. In this scenario, when you boot the new vdi, the machine will "fail to raise" Network Interfaces. This happens because the host has given the guest a new network interface that doesn't match the network interface from the corrupted vdi. Simply open a rescue shell and run

#ifconfig -a
This will identify the new network interface name. Then edit the network interfaces name config for your machine... (debian 10: ex, "eth0")

#nano /etc/network/interfaces

After you have added the correct network interface name run:

#ifconfig "eth0" down && ifnfig "eth0" up

Then reboot.. Your done.. back to work! :-)


My reference:
https://www.gnu.org/software/ddrescue/m ... ant-advice
https://manpages.debian.org/buster/gddr ... .1.en.html
https://www.technibble.com/guide-using- ... over-data/
https://www.tecmint.com/install-virtual ... in-ubuntu/
https://askubuntu.com/questions/758594/ ... ng-up-eth0
Post Reply