diff --git a/Documentation/partition.md b/Documentation/partition.md index 1dab93f1a..b8d9159b1 100644 --- a/Documentation/partition.md +++ b/Documentation/partition.md @@ -41,40 +41,27 @@ Sometime the bootloader part can look different because there can be firmware or The data partition is the only partition with real I/O. It will be expanded automatically at boot to the full size of the disk. -## Using datactl to move the data partition. +## Using CLI to move the data partition. -In a Home Assistant OS installation, the data is stored on the `/mnt/data` partition of the SD card. This is the only read+write partition on the SD drive. Using the `datactl` move command, this partition can be moved off of the SD card onto an externally connected drive, leaving the rest of the read-only system on the SD. +In a Home Assistant OS installation, the data is stored on the `/mnt/data` partition of the boot storage (typically the SD card). This is the only read/write partition on the boot storage. Using the `datadisk` move command, this partition can be moved to an externally connected drive, leaving the rest of the read-only system on the boot storage. -The storage capacity of the external drive must be larger than the storage capacity of the existing SD card. - -The command needs to be run from the host console by either connecting a keyboard and monitor or making use of the [debug ssh access](https://developers.home-assistant.io/docs/operating-system/debugging/) over port 22222. The command will not work from within an SSH add-on container. - -Log in as `root` to get to the Home Assistant CLI and then enter `login` to continue to the host. - -Confirm your USB SSD/HD is connected and recognized using `fdisk -l`. - -With the drive connected, use the following command (replacing sdx with your drive, without a partition number): +The storage capacity of the external drive must be larger than the storage capacity of the existing disk. ```sh -$ datactl move /dev/sdx +$ ha os datadisk move /dev/sdx ``` -Enter "yes" to confirm the operation. This will prepare the disk, however, the -actual move will be running on next reboot. This will make the first boot significantly longer than usual; please be patient. Reboot with the following command: +This will make a reboot which going significantly longer than usual; please be patient! + +For getting a list of supported detected devices which can be used by `datadisk`: + ```sh -$ ha host reboot +$ ha os datadisk list ``` -Once complete, the external drive -will contain the data and will need to be plugged in to successfully boot Home -Assistant. +## Using UI to move the data partition. -## Check if the move was succesful. -Within the Home Assistant interface you won't see if the move was succesful. To check this, go to your host console again (as described above) and enter: -```sh -$ systemctl status mnt-data.mount -``` -If the data partition was moved to your USB drive you should see ```sh Active: active (mounted) ``` in the output. Also, it will show, which drive got mounted as /mnt/data (```sh Where ``` and ```sh what ``` section of the output) +__follow__ ## Check Power Supply Rating diff --git a/buildroot-external/package/os-agent/os-agent.mk b/buildroot-external/package/os-agent/os-agent.mk index f4de2db80..e11d8f26d 100644 --- a/buildroot-external/package/os-agent/os-agent.mk +++ b/buildroot-external/package/os-agent/os-agent.mk @@ -4,7 +4,7 @@ # ################################################################################ -OS_AGENT_VERSION = 1.1.0 +OS_AGENT_VERSION = 1.2.0 OS_AGENT_SITE = $(call github,home-assistant,os-agent,$(OS_AGENT_VERSION)) OS_AGENT_LICENSE = Apache License 2.0 OS_AGENT_LICENSE_FILES = LICENSE diff --git a/buildroot-external/rootfs-overlay/usr/bin/datactl b/buildroot-external/rootfs-overlay/usr/bin/datactl deleted file mode 100755 index 594b5c63d..000000000 --- a/buildroot-external/rootfs-overlay/usr/bin/datactl +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -# ============================================================================== -# Home Assistant OS data partition handling -# ============================================================================== -set -e - -# Use current mount point. This avoids "Can't be the same disk!" error -# when using a drive which has been used as a data drive previously. -DATA_DEVICE_CHILD="$(findmnt --noheadings --output=source /mnt/data)" -DATA_DEVICE_ROOT="/dev/$(lsblk -no pkname "${DATA_DEVICE_CHILD}")" - -if [ "${DATA_DEVICE_ROOT}" = "" ]; then - echo "[ERROR] Data disk device not found!" - exit 1 -fi - -# Move command -if [ "${1}" = "move" ] && [ -e "${2}" ]; then - NEW_DEVICE_ROOT="${2}" - - # Check device - if ! lsblk "${NEW_DEVICE_ROOT}" | grep disk > /dev/null 2>&1; then - echo "[ERROR] Is not disk!" - exit 1 - elif [ "${NEW_DEVICE_ROOT}" = "${DATA_DEVICE_ROOT}" ]; then - echo "[ERROR] Can't be the same disk!" - exit 1 - fi - - # Flag device - if [ -z "${DATACTL_NOCONFIRM}" ]; then - echo "WARNING: All partitions on ${NEW_DEVICE_ROOT} will be deleted!" - printf "Enter \"yes\" to confirm: " - read -r confirm - if [ "${confirm}" != "yes" ]; then - echo "Aborting." - exit 1 - fi - fi - - # Create GPT partition table with a single data partition - cat << EOF | sfdisk --wipe-partitions=always --wipe=always "${NEW_DEVICE_ROOT}" -label: gpt -uuid=a52a4597-fa3a-4851-aefd-2fbe9f849079, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name=hassos-data-external -EOF - - # Since we create a new partition table etc. we are guaranteed the target - # partition is partition 1 - NEW_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${NEW_DEVICE_ROOT}")1/size") - OLD_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${DATA_DEVICE_CHILD}")/size") - - if [ "${NEW_DEVICE_PART_SIZE}" -lt "${OLD_DEVICE_PART_SIZE}" ]; then - echo "[INFO] Target device too small!" - echo "label: gpt" | sfdisk "${NEW_DEVICE_ROOT}" - exit 1 - fi - - touch "/mnt/overlay/move-data" - cat << EOF - -Disk ${NEW_DEVICE_ROOT} has been prepared to be used as data drive and the data -move has been scheduled for the next reboot. Please reboot the device now and -make sure to leave the disk connected to the system from now on. -EOF - -else - cat << EOF -Usage: datactl move - -Moves data partition to external device provided by (without partition -number). A new partition table and a partition for the complete device will be -created by datactl. -EOF - -fi -