mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-27 15:06:29 +00:00
Update OS-Agent 1.2.0 & adjust datadisk support (#1554)
* Update OS-Agent & adjust datadisk support * Update Documentation/partition.md Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
parent
fe1d3fc29a
commit
cbbecc355b
@ -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.
|
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 storage capacity of the external drive must be larger than the storage capacity of the existing disk.
|
||||||
|
|
||||||
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):
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ datactl move /dev/sdx
|
$ ha os datadisk move /dev/sdx
|
||||||
```
|
```
|
||||||
|
|
||||||
Enter "yes" to confirm the operation. This will prepare the disk, however, the
|
This will make a reboot which going significantly longer than usual; please be patient!
|
||||||
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:
|
|
||||||
|
For getting a list of supported detected devices which can be used by `datadisk`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ha host reboot
|
$ ha os datadisk list
|
||||||
```
|
```
|
||||||
|
|
||||||
Once complete, the external drive
|
## Using UI to move the data partition.
|
||||||
will contain the data and will need to be plugged in to successfully boot Home
|
|
||||||
Assistant.
|
|
||||||
|
|
||||||
## Check if the move was succesful.
|
__follow__
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
## Check Power Supply Rating
|
## Check Power Supply Rating
|
||||||
|
@ -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_SITE = $(call github,home-assistant,os-agent,$(OS_AGENT_VERSION))
|
||||||
OS_AGENT_LICENSE = Apache License 2.0
|
OS_AGENT_LICENSE = Apache License 2.0
|
||||||
OS_AGENT_LICENSE_FILES = LICENSE
|
OS_AGENT_LICENSE_FILES = LICENSE
|
||||||
|
@ -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 <device>
|
|
||||||
|
|
||||||
Moves data partition to external device provided by <device> (without partition
|
|
||||||
number). A new partition table and a partition for the complete device will be
|
|
||||||
created by datactl.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user