Migrate Home Assistant to HassOS Running on Proxmox
Installing Home Assistant on Proxmox is relatively straightforward thanks to a script by Whiskerz007 on GitHub.
I will not detail the steps here as they are pretty well documented both in the README and on the Home Assitant message boards.
This topic is about migrating the data from an existing Home Assistant installation into HassOS.
The complication is that HassOS mostly has a read-only file system and for whatever reason SCP is not working correctly.
The work around presented here is to mount the HassOS disk directly in Proxmox
and rsync the files from the old intallation to the new one.
Finding HassOS Disk and Partition⌗
The first thing that needs to be done is identify the ZFS volume that Proxmox put your HassOS install onto.
$ qm list
VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
103 hassosova-4.12 running 1024 6.00 15517
My VMID is 103.
$ VMID=103
$ qm config $VMID | grep sata0:
sata0: pond-zfs:vm-103-disk-1,size=6G
My Proxmox storage volume is pond-zfs:vm-103-disk-1. Now interrogate the
partitions.
$ DISK="pond-zfs:vm-103-disk-1"
$ fdisk -l $(pvesm path $DISK)
Disk /dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1: 6 GiB, 6442450944 bytes, 12582912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 8192 bytes
I/O size (minimum/optimal): 8192 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: A7C7AC6E-1B3B-4BB8-9428-F43B64D7E79D
Device Start End Sectors Size Type
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p1 2048 67583 65536 32M EFI System
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p2 67584 116735 49152 24M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p3 116736 641023 524288 256M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p4 641024 690175 49152 24M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p5 690176 1214463 524288 256M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p6 1214464 1230847 16384 8M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p7 1230848 1427455 196608 96M Linux filesystem
/dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p8 1427456 12582878 11155423 5.3G Linux filesystem
My partition is /dev/zvol/pond/srv/proxmox/disk-image/vm-103-disk-1p8. This is
equivalent to $(pvesm path $DISK)-part8.
Mounting⌗
Now that it is known $(pvesm path $DISK)-part8 is the disk and partition. Need to
mount it. Here I’ve chosen to mount it to /mnt/vm-$VMID-disk
$ blockdev --rereadpt $(pvesm path $DISK)
$ mkdir -p /mnt/vm-$VMID-disk
$ mount $(pvesm path $DISK)-part8 /mnt/vm-$VMID-disk
Copy⌗
Here I am going to use rsync but realistically any copy mechansim should work.
The path to my original conf directory is /srv/home-assistant/conf/
$ rsync -avh --progress --delete --checksum /srv/home-assistant/conf/ /mnt/vm-$VMID-disk/supervisor/homeassistant
Unmount⌗
$ umount /mnt/vm-$VMID-disk
$ rm -rf /mnt/vm-$VMID-disk