Setup weekly and daily backups

lisandro

Member
Jan 11, 2022
10
1
8
34
Hi there,

I want to config automatic backups by the following way:
- Daily: backup only important VPS and retain last 4 backups
- Weekly: backup all VPS and retain last 4 backups

I get a 8TB disk to store there all backups, I mounted it in /backup and I setup 'Max Backups' in 4 for this disk.

I see that storage from Proxmox, but the problem is that after setup these two backups jobs the system only retain the last 4 backups, usually the system keeps the last 4 daily backups, but I want to retain the last 4 daily backups and also the last 4 weekly backups.

Is there any way to do it? Is there any way to specify two different folder in the same Proxmox storage?

Regards,
Lisandro.
 
You can create two additonal folder using the CLI. For example "/backup/daily" and "/backup/weekly". Then you can add two new storages of type "directory" (WebUI: Datacenter -> Storage -> Add -> Directory), select vzdump as content type and point them to "/backup/daily" and "/backup/weekly". That way you get two backup storages on the same disk. You can then create a retention for each storage and give each backup task its own backup storage.

But you really should have a look at the Proxmox Backup Server (PBS). You would most likely save something like 75% to 87% of space because of deduplication.
 
Last edited:
  • Like
Reactions: lisandro
You also might want to remove your old directory storage. And might be possible that a pvesm YourDailyStorage --is_mountpoint yes && pvesm YourWeeklyStorage --is_mountpoint yes is required.
 
  • Like
Reactions: lisandro
Dunuin,

Yes, sure, I'm going to remove the old directory storage.

I don't understand the second part of your message. Have I to run it from terminal?

I have to replace 'YourDailyStorage' with 'backups-daily', haven't it?

For example:

# pvesm backups-daily --is_mountpoint yes && pvesm backups-weekly --is_mountpoint yes

Regards,
Lisandro.
 
Dunuin,

Yes, sure, I'm going to remove the old directory storage.

I don't understand the second part of your message. Have I to run it from terminal?

I have to replace 'YourDailyStorage' with 'backups-daily', haven't it?

For example:

# pvesm backups-daily --is_mountpoint yes && pvesm backups-weekly --is_mountpoint yes
If you created your directory storages with the IDs "backups-daily" and "backups-weekly" then yes.
A "pvesm StorgeID --is_mountpoint yes" basically tells PVE that this storage is pointing to a mountpoint and not a normal folder, so it won't create new folders when they are missing and will fail if the USB HDD isn't mounted so you don'T fill up your root filesystem by accident.
 
Dunuin,

Great! I'm going to confirm if it is necessary in my case. Thanks again for your time :)

Regards,
Lisandro.
 
Hi Dunuin,

I created two additional folders ('backups-daily' / 'backups-weekly') and deleted the previous ('backups') as you recommended. I think that now it's working as we need, thanks so much!

About '--is_mountpoint yes', the command was missing a 'set' parameter, for example:

# pvesm set backups-daily --is_mountpoint yes

Anyway, after execute this command when I access this storage I got the following error:

unable to activate storage 'backups-daily' - directory is expected to be a mount point but is not mounted: '/backups/daily' (500)

So I rolled back this configuration with:

# pvesm set backups-daily --is_mountpoint no

And the storage is now working properly. Do you know if I have to do anything else after execute the '--is_mountpoint yes' command to avoid the storage stop working?

Regards,
Lisandro.
 
Sorry. You are right, I forgot the "set".

Then it looks like you must pointing directly to the mountpoint and not a folder inside it for "--is_mountpoint" to work.
But then I got no idea how to prevent PVE from filling up your root filesystem when doing backups but the USB disk failed to mount.
 
Dunuin,

I thought the same, I'm going to investigate if there is any way to setup it in a folder inside a mountpoint. Thanks!

Regards,
Lisandro.
 
You could mount those folders again using bind-mounts (something like /backups/daily /mnt/backups-daily none defaults,bind 0 0 in fstab) so PVE could interpret them as mounted, but I think this won't fix the problem, as long as there is no check before bind-mounting the folder, if the disk is really mounted.
 
  • Like
Reactions: lisandro
you can set 'is_mountpoint' to the path of the mountpoint to check ("/backups" in your case I guess) instead of "yes" or "no" ;)
 
  • Like
Reactions: lisandro
You mean a pvesm set backups-daily --is_mountpoint "/backups" would work if the directory storage called "backups-daily" is actually pointing to "/backups/daily"?

Thats great, didn't got that this is a supported feature. But makes sense now that I read it again:
--is_mountpoint <string> (default = no)
Assume the given path is an externally managed mountpoint and consider the storage offline if it is not mounted. Using a boolean (yes/no) value serves as a shortcut to using the target path in this field.

@lisandro: So try it with a pvesm set backups-daily --is_mountpoint /backups && pvesm set backups-weekly --is_mountpoint /backups
 
Last edited:
  • Like
Reactions: lisandro
Hi Dunuin, fabian,

I have a disk mounted in /backups. After that I created two folders:
* ID: backups-daily / Directory: /backups/daily
* ID: backups-weekly / Directory: /backups/weekly

So I ran the following commands as you recommended:

# pvesm set backups-daily --is_mountpoint /backups
# pvesm set backups-weekly --is_mountpoint /backups

At this moment both storages are working properly.

I keep you posted in case something fails. Thanks so much! :)

Regards,
Lisandro.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!