[SOLVED] Datastore backup without remote PBS

keeka

Well-Known Member
Dec 8, 2019
204
24
58
Regarding backup of a datastore when there's no remote PBS to sync to.
I'd thought to periodically rsync the datastore to a removable drive and restore same way if needed. Presumably I need to halt the backup service. Is there a better approach?
Thanks.
 
You can create two local datastores. One on internal disk, one on external dsik. Then set up localhost in PBS as sync target and do a local sync between the two datastores. Then the PBS sync job will sync the backup snapshots from your internal datastore to your datastore on the external drive.
 
Last edited:
  • Like
Reactions: takeokun and keeka
You can create two local datastores. One on internal disk, one on external dsik. Then set up localhost in PBS as sync target and do a local sync between the two datastores. Then the PBS sync job will sync the backup snapshots from your internal datastore to your datastore on the external drive.
That sounds good. Thanks for the recommendation.
How would you control the sync process to accomodate a removable drive?
 
I assumed the sync ran continuously but reading further seems it is schedule based. So for my use case, I guess I need to disable schedules and run sync job manually. Or script running of the sync job.
 
Just to update this query. I followed @Dunuin advice: Set up a second datastore to pull backups from the first datastore on a manual schedule.
I then tried putting the second datastore on an NFS mounted volume. Whilst datastore creation was very slow (as per other posts), once set up the sync job seemed to run OK. This is for a small number of containers and VMs, all with small filesystems in a homelab setup.
 
Are you looking for PBS datastore on a removable drive or an NFS mount?
Thanks @keeka I was able to figure out the localhost one. I'm sure it would work the same for a USB drive.
However, now that you mention it. I have had some difficulty adding an NFS mount. I did add NFS in the fstab, since I have an rsync cronjob running to backup my PBS Datastore regularly. However, it might make more sense to just make the NFS datastore accessible as a backup location on the PBS.
When I edited the /etc/proxmox-backup/datastore.cfg to point to the NFS mounted location it won't show up and displays error.

This is the error that shows up

: GET /api2/json/admin/datastore/store004/status/?verbose=true: 400 Bad Request: [client [::ffff:172.16.10.162]:57877] unable to open chunk store 'store004' at "/mnt/PBS001/store004/.chunks" - Permission denied (os error 13)
Dec 03 08:35:18 pbs1 proxmox-backup-proxy[1667]: read fs info on "/mnt/PBS001/store004" failed - EACCES: Permission denied
Dec 03 08:35:18 pbs1 proxmox-backup-proxy[1667]: find_mounted_device failed - EACCES: Permission denied
 
Last edited:
I'd avoid rsyncing the datastore.
I only tested backing up a few containers as I've currently no spare SSD to dedicate to datastores. But both removable media and NFS worked for me.

For syncing to a datastore on removable media, you need to manage the datastore after inserting media and prior to removing it.
AIUI `proxmox-backup-manager` provides for creating new datastores but doesn't currently support hooking up an existing but 'offline' datastore. You have to do that by modifying `/etc/proxmox-backup/datastore.cfg` and restarting the service.

Re NFS backed datastore, I did encounter some issues initially (EACCES?). I never made any notes so it couldn't have been too perplexing :-/ If I remember right all I did was use an NFSv4 export with no_root_squash. The root permissions were indeed required for the initial datastore creation. But once up, I think it is only backup user (34:34 on debian) that needed write permissions.

Mount the NFS export in the host filesystem e.g. '/srv/nfs'.
Then in PBS, create a new datastore & set its directory under that mount point. e.g. `/srv/nfs/datastore2`
In the new datastore, create a sync job to pull your existing live backups. Or have your PVE host backup directly to the new datastore. No need to edit the datastore.cfg directly.

Essentially I think your problem is the datastore structure is absent because you ahve not created it via the gui or run `proxmox-backup-manager datastore create ...`
 
Last edited:
  • Like
Reactions: takeokun
I'd avoid rsyncing the datastore.
I only tested backing up a few containers as I've currently no spare SSD to dedicate to datastores. But both removable media and NFS worked for me.

For syncing to a datastore on removable media, you need to manage the datastore after inserting media and prior to removing it.
AIUI `proxmox-backup-manager` provides for creating new datastores but doesn't currently support hooking up an existing but 'offline' datastore. You have to do that by modifying `/etc/proxmox-backup/datastore.cfg` and restarting the service.

Re NFS backed datastore, I did encounter some issues initially (EACCES?). I never made any notes so it couldn't have been too perplexing :-/ If I remember right all I did was use an NFSv4 export with no_root_squash. The root permissions were indeed required for the initial datastore creation. But once up, I think it is only backup user (34:34 on debian) that needed write permissions.

Mount the NFS export in the host filesystem e.g. '/srv/nfs'.
Then in PBS, create a new datastore & set its directory under that mount point. e.g. `/srv/nfs/datastore2`
In the new datastore, create a sync job to pull your existing live backups. Or have your PVE host backup directly to the new datastore. No need to edit the datastore.cfg directly.
Hello @keeka I think I need to figure out what permission issues are happening.
When you say restart the service which ones needs to be restarted?
I managed to mount the NFS and create a store just like you mentioned, but when I go to access it in the GUI it shows an error
Bad Reques (400)
unable to open chunk store Permission denied (os error 13)
I added the no_root_squash to my fstab.
but I also rebooted the PBS and it seems to be accessible now....
 
Last edited:
'no_root_squash' is needed in the relevant share definition in `/etc/exports` on the NFS server. Your export config depends to some extent on whether you are using NFS v4. But PBS should be able to mount any NFS version.

Check to see if datastore structure (chunk store etc) exists. `ls -al /path/to/datastore/`.
Try as root to create a file in the datastore. `touch /path/to/datastore/test`
For good measure, log in to the NFS server and check there also.
 
Last edited:
somehow I got it working. Wasn't sure exactly sure, but
these are the settings I put in fstab nfs rw,async,soft,intr,noexec 0 0
 

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!