VM not reachable - how to restart automatic

vikozo

Renowned Member
May 4, 2014
781
31
93
suisse
www.wombat.ch
Hello
i have a Problem, i have a Proxmox Server and a FreeNAS
on the Proxmox i created a VM with a 50GB HD from the FreeNAS

Normali it works fine like this - but sometimes the VM crash with a IO Error.
FreeNAS shows no error about this.
From Proxmox it is not possible to do a restart, have to do a QM Stop 162 , restart and then it works.
Proxmox itself do not check this and would have a option to restart the VM?
or a script something like

if ping io - die (do nothing)
else stop vm, reset vm , start vm

as chron job every minute

thanks for feedback
have a nice day
vinc
 
Hi,
ideally you find the root cause of the I/O error, but yes, as a workaround you could use a script and cron job.
Does 'qemu status <VMID>' still show 'running' when the VM crashes? If it shows 'stopped' you can simply do 'qm start <VMID>' as a cron job.
Otherwise you need to detect the crash from outside and stop the VM first. Where does the I/O error message appear?
 
@Fabian_E Thanks for your Feedback
it happens today i think it happens when all the backups happens down to the FreeNAS too.

the error is
in the Gui Status running (io-error)

# qemu status 162
-bash: qemu: command not found

# qm status 162
status: io-error

# qm reset 162
did stop it seen on the GUI

# qm resume 162
did start the vm seen on the GUI

and back to live....
 
Yes, I meant 'qm status', sorry about that.
Maybe rate-limiting the backups helps (if they are not already). See Sections 15.4 and 15.3.1 of the Admin Guide.
Otherwise the cron job with the qm commands might be your best option.
 
i did wrote something like this

1 #!/bin/bash
2 ping -c4 10.147.42.63 > /dev/null
3
4 if [ $? != 1 ]
5 then
6 echo "Host found"
7 qm status 162
8
9 else
10 echo "host not found - restart...."
11 qm status 162
12 qm reset 162
13 qm resume 162
qm start 162
14 qm status 162
15 fi
==========================================

the only problem, last time the host did not answer to ping this time it did
 
So it answered the ping even though it was in the io-error state?
Instead of using ping you could use the output of 'qm status', i.e. something like
Code:
if [ `qm status 162 | cut -d" " -f2` == 'io-error' ]
then
qm reset ...
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!