VirtualBox How to mount an old Home Assistant vdi with Linux

I had to reinstall Home Assistant in a new VirtualBox. I wanted to retrieve some of the files that were in the previous virtual disk (vdi). I spent hours Googling and trying. This is what worked for me.

$ VBoxManage clonehd --format RAW /path/to/filename.vdi old_haos.img

$ parted old_haos.img

WARNING: You are not superuser. Watch out for permissions.
GNU Parted 3.6
Using /home//old_haos.img
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print
Model: (file)
Disk /home/
/old_haos.img: 107374182400B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1048576B 34603007B 33554432B fat16 hassos-boot boot, esp
2 34603008B 59768831B 25165824B hassos-kernel0
3 59768832B 328204287B 268435456B hassos-system0
4 328204288B 353370111B 25165824B hassos-kernel1
5 353370112B 621805567B 268435456B hassos-system1
6 621805568B 630194175B 8388608B hassos-bootstate
7 630194176B 730857471B 100663296B ext4 hassos-overlay
8 730857472B 107374165503B 106643308032B ext4 hassos-data

(parted) ^C

$ udisksctl loop-setup --file old_haos.img

==== AUTHENTICATING FOR org.freedesktop.udisks2.loop-setup ====
Authentication is required to set up a loop device
Authenticating as: ***
Password:
==== AUTHENTICATION COMPLETE ====
Mapped file old_haos.img as /dev/loop7.

$ sudo mount /dev/loop7p8 /mnt/haos

[sudo] password for ****:

$ ls /mnt/haos

docker logs lost+found rauc.db supervisor swapfile

1 Like