External USB drive for Hass.io snapshots

Based on my poking around remotely just now, it appears as though the USB drive is being automatically mounted as /media/USB. Based on that, how would you suggest I replace the destination /backup (where the snapshots get automatically stored) with /media/USB?

Step 1: Find the dev name for the USB drive fdisk -l
Step 2:

umount /media/USB
umount /backup
mount <dev name from the fdisk command> /backup

That should unmount the USB form /media/USB and unmount /dev/mmcblk0p6 from /backup and then mount your USB as /backup producing the result you want.

Unfortunately fdisk -l returns nothing.

Are you root?

Default login for hass.io is root but there is no access to the core system in hass.io hence the confusion and questions in regards to how it’s done.

Sorry @xbmcnut it looks like you’re going to need help from someone with more experience with hass.io :frowning:

Agreed @firstof9. Thank you very much for your help. I think the instructions could do with some lay person clarification.

Did you ever find the solution to mounting external drives in HASSIO?

@tmharris. Sorry, no.

Any progress to mounting external drives so far?

Not sure if it is what the TS wanted to achieve, but I was able to create a backup of my /config/ folder following this steps on my RPi running Hass.io :

  1. ssh [email protected]

  2. create your favourite backup script (here is my one based on a script found here)
    #!/bin/bash
    #set -x

Developed 30Nov2016

Chip Cox

designed to backup hass directory from a Raspberry Pi running Home Assistant in a virtual environment

Set Directory and filename variables

This is the mount point for my usb drive.

your destination directory will probably be different

filedir=/media/usb/

I’m starting this backup in the home directory for the hass user.

srcdir="/config/"

#current date format DDMONYYYY
current_time=$(date +"%Y%m%d_%H%M%S")

build output filename

filename=$filedir"hass"$current_time"backup.tar"

display backup information.

echo $filename > ~/backup.log
echo “Current Time : $current_time” >> ~/backup.logi

Create athe tar file given with verbose output and put the contents of srcdir in it.

excluding .cache directory

cmd=“tar -cvf $filename --exclude .cache --exclude .db --exclude ._* --exclude .DS_Store --exclude .TemporaryItems --exclude .cloud --exclude home-assistant.log $srcdir”

echo $cmd >> ~/backup.log

DoIt

eval $cmd >> ~/backup.log
#now that you have the tar file, zip it up to save space.
gzip $filename >> ~/backup.log

  1. save it as backupha anywhere and then move to /usr/local/bin/
  2. plug in a USB drive into RPi
  3. in terminal type backup and hit Enter.

After all that your filedir will contain a backup file and in your home directory there will be backup.log file with all backup output.

Hi,

have a pull request pending for Hassio to add support for using a backup filesystem, which can be located on a USB stick for example.

https://github.com/home-assistant/hassos/pull/470

Thanks.

Phill.

1 Like

I suppose that backup could be used for storing other stuff as well? :slight_smile:

No different to current backup location really in terms of what you can do. There are issues with the supervisor container occasionally starting first so I wouldn’t rely on using it for anything that utilises that from boot.

Sound good! Thinking of using it as a ftp location for my ip camera videos.

you need to ssh on port 2222

Hi @pssc

I saw Your changes has been never merged do develop - is there anyway to apply them ‘locally’ on my own?

Hi, Did anyone find a solution to do this?

Hi @michal.mydlarz & @radek-foltyn my solution here was not to use hassio and use a debian/raspbain based install an mount backup dir in the host… its also worth nothing there is further write amplification through the temporary tar being written to a tmpdir on the sdcard.

Phill.