Transferring a disk from a machine to a container

tayra

Active Member
Sep 25, 2017
11
0
41
52
Hi!
I have a virtual machine with a large capacity disk. Required to connect this disk to the lxc container. I created a new disk in the container, then using lvm2-tools renamed the disk I needed, giving it the name of the one created in the container. When launched, the container gives an error that the container did not start. It is impossible to copy data between disks, there are several terabytes.. How can I connect a disk from another virtual machine to the lxc container?
 
How can I connect a disk from another virtual machine to the lxc container?

short answer: you cannot. Those technologies are fundamentally different in their disk layout.

long answer:
Depends on a lot of things, in general it should be possible:
- Often, people partition their non-boot-disks, so you probably need to expose the partitions via kpartx
- mount the partition directly in to the container from the PVE host, which is very easy with ZFS, but I haven't tried it with LVM, probably the same.
- copy/rsync the files
- unmount and remove partition bindings with kpartx.
 

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!