k0lter / autopostgresqlbackup

Automated tool to make periodic backups of PostgreSQL databases
52 stars 17 forks source link

Should have an option to use hardlinks to save disk space #20

Closed naoliv closed 1 year ago

naoliv commented 1 year ago

As it is now, autopostgresqlbackup creates duplicate files on disk. For example:

# sha1sum latest/postgres_globals_2023-05-04_08h48m.quinta.sql.gz daily/postgres_globals/postgres_globals_2023-05-04_08h48m.quinta.sql.gz 
7d69994ce2bbbfd09a0e6c521c79596012b9d814  latest/postgres_globals_2023-05-04_08h48m.quinta.sql.gz
7d69994ce2bbbfd09a0e6c521c79596012b9d814  daily/postgres_globals/postgres_globals_2023-05-04_08h48m.quinta.sql.gz

On disk, they are using different inodes, which means they are unnecessarily consuming disk space:

# ls -i latest/postgres_globals_2023-05-04_08h48m.quinta.sql.gz daily/postgres_globals/postgres_globals_2023-05-04_08h48m.quinta.sql.gz
114430433 daily/postgres_globals/postgres_globals_2023-05-04_08h48m.quinta.sql.gz  114430432 latest/postgres_globals_2023-05-04_08h48m.quinta.sql.gz

If possible, autopostgresqlbackup should use hard links to save space.

k0lter commented 1 year ago

@naoliv Starting from version 2.0, the "latest feature" is no longer supported (see Changelog).

naoliv commented 1 year ago

Oh, I didn't see this before. Thanks!