Move Datastore location

Sep 8, 2019
32
5
13
34
I've created a zpool of an entire disk at /mnt/datastore/mypool using the PBS GUI.

Later on, I've noticed I can't set individual pruning settings per VM. Settings exist per datastore only.

I can set up Cronjobs to do VM-specific pruning (e.g. /usr/bin/proxmox-backup-client prune vm/126 --keep-last 3 --quiet 1 --repository root@pam@127.0.0.1:mypool), but prefer doing the settings in the GUI as intended.

This is my current datastore:

Bash:
cd /mnt/datastore/mypool/
ls -la
total 8271
drwxr-xr-x     4 backup backup     6 Feb 24 20:33 .
drwxr-xr-x     4 root   root       4 Nov 22 13:57 ..
drwxr-x--- 65538 backup backup 65538 Nov 21 17:26 .chunks
-rw-r--r--     1 backup backup   352 Feb 24 20:33 .gc-status
-rw-r--r--     1 backup backup     0 Nov 21 17:26 .lock
drwxr-xr-x     7 backup backup     7 Feb 25 05:00 vm

I would like to move this datastore with all its content to a subdirectory mydatastore1 and create another subdirectory for a second datastore mydatastore2. I imagine something like this:

Bash:
cd /mnt/datastore/mypool/
mkdir mydatastore1
mv -r * mydatastore1
mkdir mydatastore2

and then edit /etc/proxmox-backup/datastore.cfg by changing the following...

Code:
datastore: mypool
        gc-schedule 20:30
        keep-daily 2
        keep-hourly 22
        keep-last 8
        path /mnt/datastore/mypool
        prune-schedule *:0/30

... to:

Code:
datastore: mydatastore1
        gc-schedule 20:30
        keep-daily 2
        keep-hourly 22
        keep-last 8
        path /mnt/datastore/mypool/mydatastore1
        prune-schedule *:0/30


datastore: mydatastore2
        gc-schedule 20:30
        keep-last 3
        path /mnt/datastore/mypool/mydatastore2
        prune-schedule *:0/30

Is my plan viable? Do I need to stop PBS in between the process, to avoid any problems? (How to do that?)
 
Hi!

First, I recently directed a user here to do a move of the underlying datastore path, which was necessary as they had "nested" datastores, causing some confusion in the backup daemons, so maybe checking that post/thread out can help here:
https://forum.proxmox.com/threads/root-disk-filling-up.84215/#post-370415

datastore mydatastore2. I imagine something like this:
Attention! Using the * glob will bite you as there are hidden files which must be moved too, and the shell does not pick those up when using *. Further, directory permissions matter as the backups are handled by a process running as rather unprivileged user.

Bash:
cd /mnt/datastore/mypool/
mkdir mydatastore1
# ensure permissions are OK
chown backup:backup mydatastore1

# stop PBS services, avoiding bad access/out-of-sync state
systemctl stop proxmox-backup-proxy.service proxmox-backup.service

# move the data over, should be quick as it is a move on the same filesystem -- it may complain
# about "No such file or directory" for some of those, that's OK as not all backup group types need to exist
mv .chunks/ .gc-status .lock vm ct host ns mydatastore1/

# now edit the config adapt the "path" property of the "mydatastore1" entry
nano /etc/proxmox-backup/datastore.cfg

# start the daemons again
systemctl start proxmox-backup-proxy.service proxmox-backup.service

You may also notice that I omitted creating the second, new, datastore directory - that is intended as a datastore directory is more than an empty folder.

Handle that rather by using our tooling:
Bash:
proxmox-backup-manager datastore create mydatastore2 /mnt/datastore/mypool/mydatastore2 --prune-schedule '*:0/30' --gc-schedule '20:30' --keep-last 3

That command ensures correct permissions and creates the required directory structures for the content addressable storage.

and then edit /etc/proxmox-backup/datastore.cfg by changing the following...
That's fine, but as said only change the existing ones path, create the new with above command.

Is my plan viable? Do I need to stop PBS in between the process, to avoid any problems? (How to do that?)
Goes in the right direction, see above for important adaption - without those it will fail.
Oh and yeah, you should stop some PBS services, see above for that too.

edit: add new (since 2.1) ns namespace directory to the moved ones
 
Last edited:

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!