Check Ubuntu Disk Space Before Saving Home Assistant Backups

Before copying a Home Assistant backup to an Ubuntu server, check the destination filesystem rather than assuming the server has room. A disk can have spare capacity and still refuse a new file if it has run out of inodes. Computers do enjoy a technicality.

This is a read-only check for a server where you plan to keep backup copies. It does not verify the backup itself.

What you need

  • Shell access to the Ubuntu server and permission to inspect the intended backup directory.
  • The size of the backup file you want to copy and the path to its destination.
  • The standard df and du utilities.

In the commands below, replace /path/to/backup-directory with your actual destination. It is a placeholder, not a suggested directory.

Check the destination

  1. Check available space. Run:
    df -h /path/to/backup-directory

    The Available column shows space available on the filesystem containing that directory. Compare it with the backup file size, leaving extra room rather than aiming for the last byte. The mount point tells you which filesystem you are checking.

  2. Check inodes. Run:
    df -i /path/to/backup-directory

    Inodes track filesystem objects such as files and directories. If IFree is zero, creating another file can fail even when the earlier check shows free space.

  3. Check the directory’s current size. Run:
    du -sh /path/to/backup-directory

    This gives an approximate total for the directory, not a list of individual backups. It can help you judge how much space that collection already occupies.

Test and troubleshoot

Before copying, confirm that both checks refer to the intended destination and that available space exceeds the backup size. After copying, run them again and check that the file is present in the destination. Space figures may change for other reasons while the server is running.

If du reports permission errors, its total may be incomplete. Check access before drawing conclusions. If df and du appear to disagree, they measure different things: df reports filesystem usage, while du sums usage beneath a path. Deleted files still held open by a process can also account for a difference.

What remains unverified

These commands do not establish whether the backup is complete, restorable or within any applicable user quota. Verify the backup separately. I would also avoid posting command output publicly without checking it for private paths and other identifying details.

Leave a Reply

Your email address will not be published. Required fields are marked *