Hello.
Maybe I am reinventing the wheel, but I am having trouble and have created a script.
Background
Proxmox stores cluster configuration in
Understanding
Using
The
The script is available on GitHub:
https://github.com/flathill/Proxmox/blob/main/proxmox_config_to_fs.py
Let me know if you have any feedback or improvements!
Maybe I am reinventing the wheel, but I am having trouble and have created a script.
Background
Proxmox stores cluster configuration in
config.db
, which is usually mounted under /etc/pve/
using pmxcfs
(Proxmox Cluster File System). However, there are some challenges when trying to access it:
- If the cluster is not running,
/etc/pve/
is not mounted.
config.db
is in SQLite format, making it unreadable with simple commands likecat
.
config.db
and developed a script to reconstruct the filesystem from its contents.Understanding config.db
Using sqlite3
, you can inspect the database:
Code:
sqlite3 config.db ".tables"
sqlite3 config.db "SELECT * FROM tree LIMIT 5;"
tree
table contains file and directory information:inode | parent | type | name | data |
---|---|---|---|---|
0 | 0 | 8 | version | (NULL) |
2 | 0 | 8 | datacenter.cfg | (binary) |
8 | 0 | 4 | virtual-guest | (NULL) |
type=4
represents directories.
type=8
represents files.
- The
parent
column determines the directory structure.
The Solution: A Reconstruction Script
To automate the extraction and reconstruction, I createdproxmox_config_to_fs.py
:
Code:
python3 proxmox_config_to_fs.py config.db -o ./reconstructed_fs --verbose --debug
--debug
: Displays SQLite records.
--verbose
: Shows detailed information about file and directory creation.
Conclusion
config.db
provides a structured way to store the Proxmox cluster configuration, but it is not easily accessible when the cluster is down. This script allows users to extract and reconstruct the filesystem from config.db
without needing a running cluster.The script is available on GitHub:
https://github.com/flathill/Proxmox/blob/main/proxmox_config_to_fs.py
Let me know if you have any feedback or improvements!