mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
Add to nav, fix typos, and minor layout changes
This commit is contained in:
parent
d2b94034c1
commit
d58e145e3c
@ -9,16 +9,14 @@ sharing: true
|
||||
footer: true
|
||||
---
|
||||
|
||||
Backing upyour Home Assistant configuration to USB.
|
||||
A good plus side is that you don't need to mask all your passwords since the backup is locally at your home/residence.
|
||||
Backing upyour Home Assistant configuration to USB. A good plus side is that you don't need to mask all your passwords since the backup is locally at your home/residence.
|
||||
|
||||
### {% linkable_title Requirements %}
|
||||
|
||||
First you need a USB stick. Once you have one you need to prepare it to be used on your device.
|
||||
Once connected you want to format/work with the drive. To know what path it is in, you can check with dmesg.
|
||||
Once connected you want to format/work with the drive. To know what path it is in, you can check with `dmesg`.
|
||||
|
||||
```
|
||||
root@hassbian:/media# dmesg|grep sd
|
||||
```bash
|
||||
# dmesg | grep sd
|
||||
[ 0.909712] sdhci: Secure Digital Host Controller Interface driver
|
||||
[ 0.916414] sdhci: Copyright(c) Pierre Ossman
|
||||
[ 0.923366] sdhost: log_buf @ bac07000 (fac07000)
|
||||
@ -34,20 +32,22 @@ root@hassbian:/media# dmesg|grep sd
|
||||
[726259.209004] sd 0:0:0:0: [sda] Attached SCSI removable disk
|
||||
```
|
||||
|
||||
Here we see we have a drive on /dev/sda1. We assume you created a partition on the drive to start with. This can be any type of partition. Preffered is a linux one so you can set permissions!
|
||||
Mount the drive (as root) to /media
|
||||
Here we see we have a drive on `/dev/sda1`. We assume you created a partition on the drive to start with. This can be any type of partition. Preferred is a Linux filesystem type so you can set permissions!
|
||||
|
||||
```
|
||||
root@hassbian:~# mount /dev/sda1 /media/
|
||||
Mount the drive (as root) to `/media`
|
||||
|
||||
```bash
|
||||
# mount /dev/sda1 /media/
|
||||
```
|
||||
|
||||
### {% linkable_title Prepare USB Stick %}
|
||||
Cd into it and create a folder called 'hassbackup' and chown it to the user that runs homeassistant. In my case group and user are both homeassistant.
|
||||
```
|
||||
root@hassbian:~# cd /media/
|
||||
root@hassbian:/media# mkdir hassbackup
|
||||
root@hassbian:/media# chown homeassistant:homeassistant hassbackup/
|
||||
root@hassbian:/media# ls -al
|
||||
Change into it and create a folder called `hassbackup` and change the ownership to the user that runs Home Assistant. In my case group and user are both `homeassistant`.
|
||||
|
||||
```bash
|
||||
# cd /media/
|
||||
/media# mkdir hassbackup
|
||||
/media# chown homeassistant:homeassistant hassbackup/
|
||||
/media# ls -al
|
||||
total 28
|
||||
drwxr-xr-x 4 root root 4096 Apr 29 10:36 .
|
||||
drwxr-xr-x 22 root root 4096 Mar 22 18:37 ..
|
||||
@ -59,41 +59,58 @@ You can ignore 'lost+found'.
|
||||
### {% linkable_title Install Dependency %}
|
||||
|
||||
In order to preserve space on your drive we use zip. Install that too.
|
||||
```
|
||||
root@hassbian:/media# apt-get install zip
|
||||
|
||||
```bash
|
||||
/media# apt-get install zip
|
||||
Reading package lists... Done
|
||||
Building dependency tree
|
||||
etc etc etc
|
||||
[...]
|
||||
Setting up zip (3.0-8) ...
|
||||
```
|
||||
|
||||
### {% linkable_title Install & run script %}
|
||||
### {% linkable_title Install and run script %}
|
||||
|
||||
Become the homeassistant user and place the following [script](https://gist.github.com/riemers/041c6a386a2eab95c55ba3ccaa10e7b0) to a place of your liking.
|
||||
Don't forget to 'chmod +x usb_backup.sh'
|
||||
Become the `homeassistant` user and place the following [script](https://gist.github.com/riemers/041c6a386a2eab95c55ba3ccaa10e7b0) to a place of your liking.
|
||||
|
||||
Open up the file and change the paths you want to use, then simply run the usb_backup.sh
|
||||
```bash
|
||||
# wget https://gist.githubusercontent.com/riemers/041c6a386a2eab95c55ba3ccaa10e7b0/raw/86727d4e72e9757da4f68f1c9d784720e72d0e99/usb_backup.sh
|
||||
```
|
||||
homeassistant@hassbian:~ $ .homeassistant/extraconfig/shell_code/usb_backup.sh
|
||||
|
||||
Make the downloaded script executable.
|
||||
|
||||
```bash
|
||||
# chmod +x usb_backup.sh
|
||||
```
|
||||
|
||||
Open up the file and change the paths you want to use, then simply run the `./usb_backup.sh`.
|
||||
|
||||
```bash
|
||||
$ .homeassistant/extraconfig/shell_code/usb_backup.sh
|
||||
[i] Creating backup
|
||||
[i] Backup complete: /media/hassbackup/hass-config_20170429_112728.zip
|
||||
[i] Keeping all files no prunning set
|
||||
```
|
||||
|
||||
### {% linkable_title Crontab %}
|
||||
In order for this to automaticly make a backup every night at 3, you can add a crontab for it as the homeassistant user.
|
||||
Change below path to where you placed the usb_backup.sh and run the following line.
|
||||
In order for this to automatically make a backup every night at 3 am, you can add a crontab for it as the `homeassistant` user.
|
||||
Change below path to where you placed the `usb_backup.sh` and run the following line.
|
||||
|
||||
```
|
||||
```bash
|
||||
(crontab -l 2>/dev/null; echo "0 3 * * * /home/homeassistant/.homeassistant/extraconfig/shell_code/usb_backup.sh") | crontab -
|
||||
```
|
||||
|
||||
### {% linkable_title Auto mount %}
|
||||
|
||||
This does not automaticly mount your usb drive at boot. You need to do that manually or add a line to your /etc/fstab
|
||||
If your drive is on /dev/sda1, you could add a entry to your /etc/fstab like so:
|
||||
```
|
||||
This does not automaticly mount your USB drive at boot. You need to do that manually or add a line to your `/etc/fstab` file.
|
||||
|
||||
If your drive is on `/dev/sda1`, you could add a entry to your `/etc/fstab` like so:
|
||||
|
||||
```text
|
||||
/dev/sda1 /media ext4 defaults,noatime 0 1
|
||||
```
|
||||
|
||||
Manual: 'mount /dev/sda1 /media'
|
||||
Manual step to mount the USB drive:
|
||||
|
||||
```bash
|
||||
# mount /dev/sda1 /media
|
||||
```
|
||||
|
@ -203,6 +203,7 @@
|
||||
<ul>
|
||||
<li>{% active_link /docs/ecosystem/backup/backup_github/ Backup to GitHub %}</li>
|
||||
<li>{% active_link /docs/ecosystem/backup/backup_dropbox/ Backup to Dropbox %}</li>
|
||||
<li>{% active_link /docs/ecosystem/backup/backup_usb/ Backup to USB device %}</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>{% active_link /docs/ecosystem/scenegen/ scenegen %}</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user