Recovering Home Assistant

Hi, my Windows computer running HA crashed and looks like it needs a clean install.

I didn’t do any particular HA backup arrangement, and I’m guessing HA was backing up to the local harddrive.

Now that I need to reformat the entire harddrive, is there any way I can retrieve the HA files before I do so? (As it’s a Windows computer, HA was running from a virtual machine - where are the files located if I were to search in a Windows environment (I can’t load the virtual machine))

1 Like

Many many questions…

How was HA installed? were you in a VM?

Depends on how your machine ‘crashed’ and what kind of install you have as to where to point you.

Thanks

  • HA was installed via a VM as the computer is a Windows machine
  • I’m not exactly sure how the machine crashed - I just found it unresponsive one day and the computer wouldn’t boot. I’m now trying to recover the files via command line in Windows bootable media
  • From diagnostics so far, it looks like it’s a problem with the hard drive
  • How do I describe what install of what I have?

A shame. It’s the disk. Let’s hope it’s not the files you’re looking for. That’s enough for now, we know what to look for, your holy grail is the VM disk file.

What VM platform? (where and what file to look for.)

VirtualBox

what does the disk file look like? is it a VDI file?

https://www.virtualbox.org/manual/ch05.html

Many thanks

This might be getting a step away from HA expertise but the problem with my hard drive is that it’s ‘locked’. I can’t copy or write files to the hard drive, and presumably this is what’s stopping it from booting.

A few things I’ve tried looks like it more or less points to the same issue:

  • bootrec /rebuildbcd: resulted in no identified Windows installation
  • bootrec /bootfix: access is denied (as above)
  • bootsect /nt60 all /MBR: C: is locked (as above)

What can I do to ‘unlock’ the drive?

I’ve never used VM’s or Containers, so I can’t help you with that.

If you think there is data on the HDD to save, then I would buy a new boot disk and use a Linux computer to try to recover data from the crashed disk. Linux generally doesn’t “respect” Windows file locking. You may find that it’s just a matter of ownership or permissions. Meanwhile, reinstall Windows on the new boot disk. Then, buy an inexpensive small form PC to run Home Assistant. I have purchased a few Intel NUCs on eBay for around $100. Add RAM and an M.2 SSD and you would have a powerful Home Assistant server.

I haven’t installed Home Assistant on it yet, but my latest toy is a Bmax Mini PC. $104 on Amazon. It’s currently running Ubuntu. I might have crashed the Windows partition, but I probably won’t miss it.

And, start backing up. My Home Assistant backups every morning at 3:00 AM to a local NAS. That has saved my bacon a few times.

Ok so you’ve read the article…Did you do the bootsec /fixmbr first before those other commands?

(@stevemann the partition is locked sounds like what the os does to the tools partition to hide it… maybe errant - Linux may have similar issues because it’s on the partition table but it’s hard to tell without a partition /volume list. )

Sp @PZ0013 short version os using the article above you know what file you’re looking for. The virtual disk for your HA install. Now as you’ve noticed something is Jacked in the partition table on that disk.

The commands you noted (if preceeded by bootsec /fixmbr) is the right intervention and if that doesn’t work I’d need to do significant investigation. (and would probably just load it up on a workbench with your favorite disk tools like spinrite and let it fix it)

Boot a linux flash drive and access the hard drive.

yep did do bootrec /fixmbr first, still same locked issue unfortunately

thanks i’ll see where i get to with spinrite then

yes … backing up to NAS … that’s exactly what i should have, now i pay the tuition fee

i actually have a similiar setup running on a minipc, is there a remote desktop function that allows Windows pcs to remote into the Ubuntu minipc server then?

so other route i tried is running WinPE to try and copy the VM disk files to another harddrive. this didn’t work - the copy works to a certain percentage then stalls and comes up with an error (friend helped with this and don’t have the error code onhand)

would linux have done anything different?

Found this, haven’t tried it but looks promising

How to Access Ubuntu via Remote Desktop from Windows (phoenixnap.com)

Depending on your windows SKU you could install Windows services for Linux and basically install a flavor of Linux right into the OS. And it should be able to open the volume.

That said, I think the volume is actually broken and you need good disk tools before any os successfully opens the partition correctly.

I use RealVNC. It’s free for up to five computers and has been rock solid. It couldn’t be easier to install. I use it on three Ubuntu servers and a Raspberry Pi. If I leave my home PC turned on, I can get to it from anywhere that I can get Internet.

I have no idea what winpe is. Sounds like your hard drive is broken, but may be worth trying a proper os.

Windows Preinstallation Environment (its what runs to actually install windows.)

It has a copy of diskpart and can be used to run tooling (most windows based disk tools use WinPE to actually boot.)