Changing the ID of a Storage Source in Proxmox

Revision as of 00:28, 3 August 2026 by Root (talk | contribs) (Created page with "How to change the name of a ID for a Proxmox BackUp Server Storage Item / Location: You don't. Why? Who knows. Is there a work around? Yes! === Work Around === <syntaxhighlight lang="text"> OLD='WhatEverSourceName' NEW='WhatEverTargetName' python3 - "$OLD" "$NEW" <<'PY' import shutil import sys from datetime import datetime from pathlib import Path old = sys.argv[1] new = sys.argv[2] cfg = Path("/etc/pve/storage.cfg") secret_dir = Path("/etc/pve/priv/storage") t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to change the name of a ID for a Proxmox BackUp Server Storage Item / Location: You don't.

Why? Who knows.

Is there a work around? Yes!

Work Around

OLD='WhatEverSourceName'
NEW='WhatEverTargetName'

python3 - "$OLD" "$NEW" <<'PY'
import shutil
import sys
from datetime import datetime
from pathlib import Path

old = sys.argv[1]
new = sys.argv[2]

cfg = Path("/etc/pve/storage.cfg")
secret_dir = Path("/etc/pve/priv/storage")

text = cfg.read_text()
old_header = f"pbs: {old}\n"
new_header = f"pbs: {new}\n"

if old_header not in text:
	print(f"ERROR: Storage ID {old!r} was not found.")
	sys.exit(1)

if new_header in text:
	print(f"ERROR: Storage ID {new!r} already exists.")
	sys.exit(1)

backup = Path(
	f"/root/storage.cfg.before-{old}-to-{new}-"
	f"{datetime.now():%Y%m%d-%H%M%S}"
)
shutil.copy2(cfg, backup)

for suffix in (".pw", ".enc", ".master.pem"):
	source = secret_dir / f"{old}{suffix}"
	target = secret_dir / f"{new}{suffix}"

	if source.exists():
		shutil.copy2(source, target)

cfg.write_text(text.replace(old_header, new_header, 1))

print(f"Changed storage ID: {old} -> {new}")
print(f"Configuration backup: {backup}")
PY

pvesm status

It's so obvious! Just deleted it and make a new one!

And of course remember, this will 'break' anything connected to that ID.

Sort of makes one wonder why the ID isn't a similar to some sort of UUID or similar then a Name instead of an ID, which would allow for changing the name that's displayed. Yes, the Proxmox Web GUI sucks.