Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

My qcow2 VM image for Home Assistant seems corrupted, thoughts?

Featured Replies

I had some issues with my server. Longs story short, I now have a seemingly corrupted qcow2 image file.

 

Every time I try to use it it either doesn't load or crashes my system. Tried to copy it to my windows machine but it fails part way through.

 

Is there any way to open it up or search through the files? I'm desperately trying to get my backups hidden inside and really don't want to start from scratch again.

 

Any help would be greatly appreciated.

Solved by ghost82

You can use qemu-nbd command line.

First backup your qcow2 file.

Then in a terminal:

Load kernel module:

modprobe nbd max_part=8

Create nbd0 block device:

qemu-nbd --connect=/dev/nbd0 /replace/with/path/to/file.qcow2

Use fdisk to list partitions and see if you get any output:

fdisk -l /dev/nbd0

Yiu can also use fsck to try to repair partitions:

fsck /dev/nbd0p1

nbd0p1 being partition 1.

 

You can also mount the partition (in this example nbd0p1) somewhere:

mount /dev/nbd0p1 /mnt/somepoint/

 

Once done, disconnect:

qemu-nbd --disconnect /dev/nbd0

 

Edited by ghost82

  • Author

I did the first 2 commands and received this on the 3rd.

 

fdisk -1 /dev/nbd0
fdisk: invalid option -- '1'

 

I tried the first 2 again and received this message. I assume this means the first 2 commands worked.

 

qemu-nbd: Failed to blk_new_open '/mnt/disks/00000000000000001358/domains/home_assistant/haos_ova-7.5.qcow2': Failed to get "write" lock
Is another process using the image [/mnt/disks/00000000000000001358/domains/home_assistant/haos_ova-7.5.qcow2]?

 

  • Author

I tried fsck /dev/nbd0p1 and received this message.

 

fsck /dev/nbd0p1
fsck from util-linux 2.37.4
fsck.fat 4.2 (2021-01-31)
Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
[12?q]? 

 

Should I go ahead and try to remove dirty bit?

 

Thanks for the help btw 👍

6 hours ago, RyanServer711 said:

I had some issues with my server. Longs story short, I now have a seemingly corrupted qcow2 image file.

 

Every time I try to use it it either doesn't load or crashes my system. Tried to copy it to my windows machine but it fails part way through.

 

Is there any way to open it up or search through the files? I'm desperately trying to get my backups hidden inside and really don't want to start from scratch again.

 

Any help would be greatly appreciated.


I've had loads of trouble in the past with the HA qcow2 image corrupting. I've always kept a spare backup qcow2 after i've set HA how i need it, and while you are at it run the Google drive backup pluygin on HA. Its also saved me before to load back an old config. On a few occasions its been the boot config which got messed up on the VM, so diving into the virtual bios and resetting the boot device has fixed it, but normally i just blow away the old qcow2 and recover from the backup image. 

  • Author

So loading a fresh install would have my backups in there? I thought they would be inside the corrupted qcow2?

 

I've done regular backup within home assistant but I didn't think they left the VM unless specifically done so.

  • Author

I assumed they were lost in the corrupted qcow2.

 

Either way I'm learning a very good lesson in backing up my stuff

is something using the qcow2 file?is the vm completely shutdown?

If so, try to remove the "dirty bit".

Edited by ghost82

1 hour ago, RyanServer711 said:
fdisk -1

it's -l not -1

  • Author

Interesting, i'll try that.

  • Author

This is what I have with the correct list command

Device        Start      End  Sectors  Size Type
/dev/nbd0p1    2048    67583    65536   32M EFI System
/dev/nbd0p2   67584   116735    49152   24M Linux filesystem
/dev/nbd0p3  116736   641023   524288  256M Linux filesystem
/dev/nbd0p4  641024   690175    49152   24M Linux filesystem
/dev/nbd0p5  690176  1214463   524288  256M Linux filesystem
/dev/nbd0p6 1214464  1230847    16384    8M Linux filesystem
/dev/nbd0p7 1230848  1427455   196608   96M Linux filesystem
/dev/nbd0p8 1427456 67108830 65681375 31.3G Linux filesystem

 

Also I did the dirty bit removal on this copy of qcow2

Edited by RyanServer711

  • Author

Wait?!? Is the VM running out of memory? Isn't the default cap lower than 32G?

  • Solution

data should be in the larger partition, nbd0p8, try to mount it somewhere.

  • Author

Crashed it, is there a recommended mount point? I just picked a folder in my backup share on my array.

 

/mnt/disk1/backup/HATEST

 

I'm going to try again

  • Author

SUCCESS!

 

I found the directory my backup are in!

  • Author

I'm back up and running! Thanks for all th

 help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.