[SOLVED] How do I remove "old" backups?

reynierpm

New Member
May 19, 2023
28
1
3
I have a 2T disk which I use for backups of VM. Currently, the disk is showing as FULL, and backup jobs started to fail. So far I am unable to find the reason or to fix the issue, by deleting old backups. First I checked the content of the `storage.cfg` file and it shows:

Code:
# cat /etc/pve/storage.cfg
dir: local
    path /var/lib/vz
    content backup,iso,vztmpl

lvmthin: local-lvm
    thinpool data
    vgname pve
    content images,rootdir

zfspool: hitachi
    pool hitachi
    content rootdir,images
    mountpoint /hitachi
    sparse 1

dir: backups
    path /hitachi/backups
    content vztmpl,iso,images,backup
    prune-backups keep-all=1
    shared 0

My first thought was that the `keep_all=1` is why the disk is full. After searching a lot on Google I finally found a post somewhere that led me to execute the following:

Code:
pvesm status
Name             Type     Status           Total            Used       Available        %
backups           dir     active      1885861248      1812462336        73398912   96.11%
hitachi       zfspool     active      1885863936      1812465024        73398912   96.11%
local             dir     active        98497780         5338492        88109740    5.42%
local-lvm     lvmthin     active      1793077248       110094943      1682982304    6.14%

# pvesm remove backups
root@pve:/var/lib/vz/dump# pvesm status
Name             Type     Status           Total            Used       Available        %
hitachi       zfspool     active      1885863936      1812465024        73398912   96.11%
local             dir     active        98497780         5338508        88109724    5.42%
local-lvm     lvmthin     active      1793077248       110094943      1682982304    6.14%

But surprisedly that did something but did not help me because the disk still shows as FULL (almost). I noticed that backups are not showing up in the UI so I can't manually remove them.


1711582188751.png


Can I get some help? If you need some extra info just let me know and I will provide it
 
dir: backups path /hitachi/backups content vztmpl,iso,images,backup prune-backups keep-all=1 shared 0
Your "backups" missing the "is_mountpoint" option so you risk filling up your root filesystem (so your PVE system disk) as backups then could end upon that instead on your 2TB disk.

Also try to run a zpool trim hitachi and fstrim -av to force an instant trimming. And check if zfs list -o space hitachi if snapshots reventing space from being freed up.
 
Last edited:
  • Like
Reactions: reynierpm
Going to answer myself since after several tries I finally found the solution. Looking closer at the output of `cat /etc/pve/storage.cfg` I noticed a `mountpoint` for the `hitachi` disk. I give this a try and `ls -la /hitachi` and voila, all I was looking for is there.

Code:
# ls -la /hitachi/backups/
total 27
drwxr-xr-x 5 root root 5 Feb 12 18:39 .
drwxr-xr-x 3 root root 3 Feb 12 18:24 ..
drwxr-xr-x 2 root root 2 Mar 28 08:05 dump
drwxr-xr-x 2 root root 2 Mar 27 18:12 images
drwxr-xr-x 4 root root 4 Feb 12 18:24 template

then I removed all the content under `dump` and my disk usage decreased from 96% to 0.58% (0.58% (11.24 GB of 1.93 TB). In addition to the above, I also modified the `storage.cfg` to keep only the 2 latest backups:

Code:
dir: backups
    path /hitachi/backups
    content vztmpl,iso,images,backup
    prune-backups keep-last=2
    shared 0

I will keep an eye on this and see how it behaves from now on
 
Last edited: