wamdam / backy2

backy2: Deduplicating block based backup software for ceph/rbd, image files and devices
http://backy2.com/
Other
195 stars 39 forks source link

delete the backend block data #51

Closed noeyhuy closed 4 years ago

noeyhuy commented 4 years ago

Why can't I delete the backend block data when I run the backy2 rm -f command?

backupdata

[root@localhost ~]# backy2 stats INFO: $ /usr/local/bin/backy2 stats +---------------------+--------------------------------------+----------------+-------------+-------------+-------------+-------------+---------------+----------------+-------------+--------------+--------------+---------------+--------------+ | date | uid | name | size bytes | size blocks | bytes read | blocks read | bytes written | blocks written | bytes dedup | blocks dedup | bytes sparse | blocks sparse | duration (s) | +---------------------+--------------------------------------+----------------+-------------+-------------+-------------+-------------+---------------+----------------+-------------+--------------+--------------+---------------+--------------+ | 2020-02-12 05:02:02 | 56c3d654-4d54-11ea-96ab-90b11c43e4ce | diff_tuesday | 23008772096 | 5486 | 23008772096 | 5486 | 2720923648 | 649 | 5762973696 | 1374 | 14524874752 | 3463 | 200 | | 2020-02-12 05:44:23 | 0286f516-4d5a-11ea-832c-90b11c43e4ce | diff_wednesday | 23011131392 | 5487 | 23011131392 | 5487 | 2752643072 | 657 | 8413773824 | 2006 | 11844714496 | 2824 | 306 | | 2020-02-12 06:36:10 | 7d267ace-4d61-11ea-b4dc-90b11c43e4ce | diff_thursday | 23014932480 | 5488 | 23014932480 | 5488 | 2806775808 | 670 | 11035213824 | 2631 | 9172942848 | 2187 | 200 | | 2020-02-12 06:54:34 | 1065a362-4d64-11ea-9dfd-90b11c43e4ce | diff_friday | 23017881600 | 5488 | 23017947136 | 5488 | 2788818944 | 665 | 13686013952 | 3263 | 6543114240 | 1560 | 199 | | 2020-02-12 07:15:48 | 04e3a374-4d67-11ea-9b6f-90b11c43e4ce | diff_saturday | 23029022720 | 5491 | 23029022720 | 5491 | 2774728704 | 662 | 16290676736 | 3884 | 3963617280 | 945 | 203 | | 2020-02-12 07:42:07 | b04666d6-4d6a-11ea-99f0-90b11c43e4ce | diff_sunday | 23031840768 | 5492 | 23031840768 | 5492 | 2802712576 | 669 | 18970836992 | 4523 | 1258291200 | 300 | 206 | | 2020-02-12 08:03:41 | ab51bb8c-4d6d-11ea-92de-90b11c43e4ce | full_monday2 | 24360714240 | 5809 | 24360714240 | 5809 | 2734882816 | 653 | 21621637120 | 5155 | 4194304 | 1 | 220 | +---------------------+--------------------------------------+----------------+-------------+-------------+-------------+-------------+---------------+----------------+-------------+--------------+--------------+---------------+--------------+ INFO: Backy complete.

... backy2 rm -f ...

backupdata deleted

[root@localhost ~]# backy2 ls INFO: $ /usr/local/bin/backy2 ls +------+------+---------------+------+------------+-----+-------+-----------+------+ | date | name | snapshot_name | size | size_bytes | uid | valid | protected | tags | +------+------+---------------+------+------------+-----+-------+-----------+------+ +------+------+---------------+------+------------+-----+-------+-----------+------+ INFO: Backy complete.

why alive the backend data?

[root@localhost ~]# du -sh /disk/home/backy2/backy.sqlite 16M /disk/home/backy2/backy.sqlite

[root@localhost ~]# du -sh /disk/home/backy2/data/ 24G /disk/home/backy2/data/

wamdam commented 4 years ago

rm only removes the metadata and inserts it in a to-be-deleted table which 'backy2 cleanup' takes up for garbage collection (after some time has passed to prevent race conditions). So after 1 hour call backy2 cleanup and the disk space should be given back. The default timeout is 1h for cleanup.