Add existing Datastore to fresh installed PBS

Supaman

Member
Jan 10, 2024
43
20
8
Hello,

i have the following setup: single PVE host, with one drive for PVE and VMs, and a second dedicated drive as PBS datastore. Due to corrupted boot drive i had to reinstall PVE and the PBS VM. The PBS datastore had been attached to the VM as raw device.

New installation is complete, but i did not manage to add the old PBS datastore.

/dev/sda is (virtual) bootdisk
/dev/sda is (rawdevice) datastore


pbs disks.jpg

pbs add datastore.png

Everything i tried the field "Backing Path", i.e. "sdb, sdb1, /sdb, /sdb1, /dev/sdb, /devsdb1" got an Error:

pbs error.png


Drive sdb is currently not mounted - if you wipe the disk, initalize and create a directory this is done automaticly.

So the question is: how to connect / re-use the existing datastore?
There are backups on the disk i need, so wiping is not an option.

regards,

Supa
 
Last edited:
Hey,

you have to mount the device (/dev/sda1 in your case) manually. The backing-path is the mountpoint then. If you never plan to use the PBS VM without the disk present you can use /etc/fstab to always mount it automatically.

So something like this
1. mount /dev/sda1 /mnt/datastore/pve2_local_m2, make sure the dir exists before mounting(mkdir -p /mnt/datastore/pve2_local_m2)
2. create the new datastore with "Reuse existing..." checked, and "Backing Path" being /mnt/datastore/pve2_local_m2

Alternatively you could add it as removable, in case you ever plan to use this disk on a different PBS, or have the VM start without it present. In that case don't mount it manually, just check "Removable Datastore" and select the correct partition.

In both cases check that the datastore is actually in the root directory of /dev/sda1, if it is not update the "Backing Path" accordingly.
 
  • Like
Reactions: Supaman
Hello Hannes,

thnks for fast reply. My old PBS datastore is located @ /dev/sdb, so the following had worked so far:
1) mkdir -p /mnt/datastore/pve2_local_m2
2) mount /dev/sdb1 /mnt/datastore/pve2_local_m2 // <---- changed to sb1

@PBS GUI - add datastore:
Backing Path: /mnt/datastore/pve2_local_m2
[x] reuse existing datastore

-> Datastore appears and is accesslible - but after reboot its gone.

So for a permanent re-use i need to modify the fstab... no problem, i will get that running.

One question left:
i have a second system with same setup, and i wiped the SSD and the permanent mounting has been done through PBS.
When i open the fstab, it shows:

Code:
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pbs/root / ext4 errors=remount-ro 0 1
/dev/pbs/swap none swap sw 0 0
proc /proc proc defaults 0

-> No entry for second drive.
Which leads me to the question, in which way PBS usually mount the drrives added by GUI ?

regards,

Supa
 
Last edited:
  • Like
Reactions: Supaman
I have done the following:

#1 - get disk UUID
>blkid/dev/sdb1
Output:

/dev/sdb1: UUID="979e2411-4695-4cfd-9016-926c2c600251" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="28648417-132d-49ee-b0ef-a63c0af9927a"

So this is the UUID needed for the next step: 979e2411-4695-4cfd-9016-926c2c600251

#2 - create file with uuid : /etc/systemd/system/mnt-datastore-pve2_local_m2.mount
(copied & modified this file from "pve1_local_m2", which has the same setup)

Code:
[Install]
WantedBy=multi-user.target

[Unit]
Description=Mount datatstore 'pve2_local_m2' under '/mnt/datastore/pve2_local_m2'

[Mount]
Options=defaults
Type=ext4
What=/dev/disk/by-uuid/979e2411-4695-4cfd-9016-926c2c600251
Where=/mnt/datastore/pve2_local_m2


# 3
adjust permissions for "mnt-datastore-pve2_local_m2.mount" to 0777
reboot


Result:
Datastore @ PBS GUi is listet, folder under "/mnt/datastore/pve2_local_m" listed, but empty.
Datastore not accessible, Error 400.

Any advice ?