Proxmox Backup Server: Difference between revisions

From DWIKI
 
(43 intermediate revisions by the same user not shown)
Line 3: Line 3:


= Documentation =
= Documentation =
*https://pbs.proxmox.com/docs/
*[https://pbs.proxmox.com/docs/ PBS documentation]
*[https://pbs.proxmox.com/docs/technical-overview.html PBS Technical overview]
*[https://pbs.proxmox.com/docs/managing-remotes.html Managing PBS remotes & sync]
 
=Processes=
==Service daemons==
See [https://pbs.proxmox.com/docs/sysadmin.html#service-daemons Service Daemons]
 
==Command line tools==
See [https://pbs.proxmox.com/docs/sysadmin.html#command-line-tools Command-line Tools]
 
 
=Under the hood=
Structure of datastore:
/mnt/datastore/yourDS
contains:
==.chunks==
The actual data
==.lock==
==vm==
Metadata per vm:
client.log.blob  drive-scsi0.img.fidx  index.json.blob  qemu-server.conf.blob
==.gc-status==
 


=HOWTO=
=HOWTO=
==Move datastore==
*Make sure there is no activity on that datastore, i suggest using rsync. As i can tell it should be safe to use rsync option '''--ignore-existing''' when updating a copy.
*Edit '/etc/proxmox-backup/datastore.cfg' to change path to datastore.
*Reload configuration ('''this will interrupt running garbage collectors''') :
systemctl reload proxmox-backup-proxy
==Upgrade proxmox 6 to 7==
https://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0
===WARN: 'noout' flag not set - recommended to prevent rebalancing during cluster-wide upgrades===
https://docs.ceph.com/en/quincy/rados/troubleshooting/troubleshooting-osd/
ceph osd set noout
==Restore disk from PBS==
Use [[pbs-restore]]
==What's so busy?==
proxmox-backup-manager list
and then
proxmox-backup-manager task log <everying from and including "UPID:">
=PBS Backups=
==Create new backup repository==
==Create new backup repository==
===On PBS server:===
===On PBS server:===
====Create account====
Configuration->Access Control->User Management->Add
====Create datastore====
  Datastore->Add Datastore
  Datastore->Add Datastore
New subdirectory will be created  
New subdirectory will be created  


Configuration->Access Control->User Management->Add
Backup path must be full path to storage + datastore name
and
 
  Configuration->Access Control->Permissions
  Configuration->Access Control->Permissions
  Datastore->yournewstore->Permissions
  Datastore->yournewstore->Permissions
to give the user access, Role is usually DatastoreBackup
to give the user access, Role is usually DatastoreBackup




Line 23: Line 78:
  Datacenter->Storage->Add->Proxmox backup server
  Datacenter->Storage->Add->Proxmox backup server
For "Datastore" enter the name as used on the PBS.
For "Datastore" enter the name as used on the PBS.
For fingerprint:
For fingerprint (on pbs server):
  proxmox-backup-manager cert info | grep Fingerprint
  proxmox-backup-manager cert info | grep Fingerprint


Then:
Then:
  Backup-Add storage: your-pbs
  Backup->Add storage: your-pbs


==Remove PBS datastore==
==Remove PBS datastore==
Line 33: Line 88:
this does not delete the data!
this does not delete the data!


===Move a PBS datastore===
rsync -auv /mnt/datastore/old /mnt/datastore/new
systemctl stop proxmox-backup-proxy
rsync -auv /mnt/datastore/old /mnt/datastore/new
vi /etc/proxmox-backup/datastore.cfg
systemctl start proxmox-backup-proxy
and after checking everything you can
rm -vf /mnt/datastore/old
==Move vm data to another datastore==
=== Create local sync user ===
localsync@pbs
Permissions: datastorereader on source, datastorebackup on target


== PBS API ==
== PBS API ==
*[https://pbs.proxmox.com/docs/user-management.html?highlight=token#api-tokens API Tokens]
*[https://pbs.proxmox.com/docs/api-viewer/ PBS API viewer]
PBS equivalent for '''pvesh''':
proxmox-backup-debug


*[https://pbs.proxmox.com/docs/api-viewer/ PBS API viewer]
example:
proxmox-backup-debug api get /status/datastore-usage
 
proxmox-backup-debug api get /nodes/localhost/tasks


===Create cookie===
===Create cookie===
Line 84: Line 162:


= FAQ =
= FAQ =
==Error messages==
===user account disabled or expired===
==Limit bandwidth==
===On cluster node===
In /etc/vzdump.conf
# In KB/s
bwlimit: 1500
==Garbage collection==
===What does the '''Prune all''' button do?===
It will give you a dialog with the usual 'Keep xxx' options.
=== TASK ERROR: update atime failed, disk full ===
Try pruning some
Check if some sync is running
===unable to access non-existent chunk===
check if this returns?
=== Pending removals ===
proxmox-backup-manager garbage-collection status mystore


== error pruning backups - check log (500) ==
== error pruning backups - check log (500) ==
Line 89: Line 190:
Possibly a permissions thing, which is good. Leave pruning to the backup server
Possibly a permissions thing, which is good. Leave pruning to the backup server


== Pending removals ==


proxmox-backup-manager garbage-collection status mystore




Line 101: Line 200:
Check
Check
   systemctl status proxmox-backup
   systemctl status proxmox-backup
==Connection error 401: No ticket==
Browser issues, try clearing cache/cookies(?) or another browser.
==Noout flag(s) set==
ceph osd unset noout
==qmp command 'query-backup' failed - got wrong command id==
maybe bwlimit?
==create storage failed: mypbs: error fetching datastores - 500 Can't connect to mypbs:8007 (Connection timed out) (500)==
==Garbage collection failed: unlinking chunk ... ENOENT: No such file or directory==
Ignore?
==Sync errror: owner check failed==
Check in datastore/yourrepository/vm/*/owner
There's command
proxmox-backup-client change-owner
==Sync remote==
==tcp connect error: deadline has elapsed==
Probably connection timeout.
===proxmox-backup-manager remote list not showing remote===
Try
proxmox-backup-manager remote show
Check
/etc/proxmox-backup/remote.cfg
===Retrieve PBS password===
On a pve node check '''/etc/pve/priv/storage/'''
===group lock failed: Permission denied===
Probably a mismatch between path in /etc/proxmox-backup/datastore.cfg and actual location.
You also need to restart proxmox-backup-proxy.service after changing either of those.
[[Category:Backup]]

Latest revision as of 15:53, 16 February 2024

 

Documentation

Processes

Service daemons

See Service Daemons

Command line tools

See Command-line Tools


Under the hood

Structure of datastore:

/mnt/datastore/yourDS

contains:

.chunks

The actual data

.lock

vm

Metadata per vm: client.log.blob drive-scsi0.img.fidx index.json.blob qemu-server.conf.blob

.gc-status

HOWTO

Move datastore

  • Make sure there is no activity on that datastore, i suggest using rsync. As i can tell it should be safe to use rsync option --ignore-existing when updating a copy.
  • Edit '/etc/proxmox-backup/datastore.cfg' to change path to datastore.
  • Reload configuration (this will interrupt running garbage collectors) :
systemctl reload proxmox-backup-proxy

Upgrade proxmox 6 to 7

https://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0


WARN: 'noout' flag not set - recommended to prevent rebalancing during cluster-wide upgrades

https://docs.ceph.com/en/quincy/rados/troubleshooting/troubleshooting-osd/

ceph osd set noout


Restore disk from PBS

Use pbs-restore


What's so busy?

proxmox-backup-manager list

and then

proxmox-backup-manager task log <everying from and including "UPID:">

PBS Backups

Create new backup repository

On PBS server:

Create account

Configuration->Access Control->User Management->Add


Create datastore

Datastore->Add Datastore

New subdirectory will be created

Backup path must be full path to storage + datastore name

Configuration->Access Control->Permissions
Datastore->yournewstore->Permissions

to give the user access, Role is usually DatastoreBackup



On PBS guest:

Datacenter->Storage->Add->Proxmox backup server

For "Datastore" enter the name as used on the PBS. For fingerprint (on pbs server):

proxmox-backup-manager cert info | grep Fingerprint

Then:

Backup->Add storage: your-pbs

Remove PBS datastore

proxmox-backup-manager datastore remove yourdatastore

this does not delete the data!


Move a PBS datastore

rsync -auv /mnt/datastore/old /mnt/datastore/new
systemctl stop proxmox-backup-proxy
rsync -auv /mnt/datastore/old /mnt/datastore/new
vi /etc/proxmox-backup/datastore.cfg
systemctl start proxmox-backup-proxy

and after checking everything you can

rm -vf /mnt/datastore/old


Move vm data to another datastore

Create local sync user

localsync@pbs

Permissions: datastorereader on source, datastorebackup on target

PBS API

PBS equivalent for pvesh:

proxmox-backup-debug 

example:

proxmox-backup-debug api get /status/datastore-usage
proxmox-backup-debug api get /nodes/localhost/tasks

Create cookie

PBS=your.pbs.server
curl --silent --insecure --data "username=zabbix@pbs&password=n0tmyp4ss" https://$PBS:8007/api2/json/access/ticket | jq --raw-output '.data.ticket' | sed 's/^/PBSAuthCookie=/' > cookie

Test cookie

curl -XGET --silent -k -b $(cat cookie ) https://$PBS:8007/api2/json/

Recovering files from backup

export PBS_REPOSITORY=mypbs:mydatastore
proxmox-backup-client snapshot list

Output like: vm/109/2022-01-25T20:18:02Z │ 200.00 GiB │ client.log drive-ide0.img index.json qemu-server.conf

# proxmox-backup-client map vm/109/2022-01-25T20:18:02Z drive-ide0.img

Image 'data2:vm/109/2022-01-25T20:18:02Z/drive-ide0.img' mapped on /dev/loop0
# lsblk

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0          7:0    0   200G  1 loop
├─loop0p1    259:0    0   251M  1 part
├─loop0p2    259:1    0   3.9G  1 part
└─loop0p3    259:2    0 195.9G  1 part

 

mount /dev/loop0p3 /mnt/loop/

mount: /mnt/loop: cannot mount /dev/loop0p3 read-only.

mount -o loop,ro,norecovery /dev/loop0p3 /mnt/loop/

and that should be it. After you're done:

umount /mnt/loop
proxmox-backup-client unmap /dev/loop0

 

TBD: explain how t o use kpartx and friends to acces LVM volumes

 

FAQ

Error messages

user account disabled or expired

Limit bandwidth

On cluster node

In /etc/vzdump.conf

# In KB/s
bwlimit: 1500

Garbage collection

What does the Prune all button do?

It will give you a dialog with the usual 'Keep xxx' options.

TASK ERROR: update atime failed, disk full

Try pruning some Check if some sync is running

unable to access non-existent chunk

check if this returns?

Pending removals

proxmox-backup-manager garbage-collection status mystore

error pruning backups - check log (500)

Possibly a permissions thing, which is good. Leave pruning to the backup server



command error: http upgrade request timed out

??

Connection error - server offline?

This can also happen when you can actually connect to server:8007 Check

 systemctl status proxmox-backup


Connection error 401: No ticket

Browser issues, try clearing cache/cookies(?) or another browser.

Noout flag(s) set

ceph osd unset noout

qmp command 'query-backup' failed - got wrong command id

maybe bwlimit?

create storage failed: mypbs: error fetching datastores - 500 Can't connect to mypbs:8007 (Connection timed out) (500)

Garbage collection failed: unlinking chunk ... ENOENT: No such file or directory

Ignore?


Sync errror: owner check failed

Check in datastore/yourrepository/vm/*/owner

There's command

proxmox-backup-client change-owner

Sync remote

tcp connect error: deadline has elapsed

Probably connection timeout.

proxmox-backup-manager remote list not showing remote

Try

proxmox-backup-manager remote show

Check

/etc/proxmox-backup/remote.cfg


Retrieve PBS password

On a pve node check /etc/pve/priv/storage/


group lock failed: Permission denied

Probably a mismatch between path in /etc/proxmox-backup/datastore.cfg and actual location. You also need to restart proxmox-backup-proxy.service after changing either of those.