[SOLVED] [Backup & Restore] How to create a CT from an existing volume (disk-image)

francoisd

Renowned Member
Sep 10, 2009
49
3
73
Concern: Backup & Restore

I restored a volume (from ceph RBD), and want to start a CT from it.
How should I create & start a CT from which I have the disk image ?

Preferably without re-creating the /etc/pve/nodes/{node}/lxc/{vmid}.conf config file from an existing one. (Consider I lost the original one).
The volume is visible with pvesm list {storage}:

Code:
root@pve2:~# pvesm list cephblock | grep 198
cephblock:vm-198-disk-0 raw     images     4294967296 198



Thanks,
 
Last edited:
you need to create the config file and then add that volume as 'rootfs'.. or alternatively, create a template from the volume (mount it, create a tar archive), then pass that to pct create).
 
Thanks Fabian,
Just created the <vmid>.conf (with an unused vmid), and it worked. Just a bit odd that we can't do it from the GUI or pvesh.


Code:
root@pve1:/# cat /etc/pve/nodes/pve1/lxc/198.conf
arch: amd64
cores: 1
features: nesting=1
hostname: ubutst1
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.10.1,hwaddr=42:C1:57:0D:52:69,ip=192.168.10.74/24,tag=10,type=veth
ostype: ubuntu
rootfs: cephblock:vm-198-disk-0,size=4G
swap: 512
unprivileged: 1

I kept the same IP/hwaddr from original.

The CT is running, and contains all the restored data from base image export and all subsequent diff-exports.

So, a backup of the /etc/pve/nodes might be of good value in case of DR. Just added:
Code:
root@pve1:/# cat /etc/cron.daily/backup_pve_config.sh
#!/bin/sh
tar -Jc /etc/pve/nodes | rclone --config /etc/rclone/rclone.conf rcat OneDriveSecure1:/pvesnapshot/etc_pve_nodes_$(date -I).tar.xz

I'm currently working on a python script to remote backup volumes to an rclone destination, with daily diff/incremental exports from snapshots & snapshot autoclean.
 
Last edited:
well usually you'd do a backup and restore ;) a container must have a rootfs, so creating a container without one is not possible over the API. and importing arbitrary file systems is rather dangerous, so that is not offered over the API either.
 

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!