PVE Adopt a Native LXD/LXC: Difference between revisions

From WikiMLT
Line 24: Line 24:
====== References ======
====== References ======


*
*Linux Containers: [https://linuxcontainers.org/lxc/security/ LXC > Security > Privileged and Unprivileged containers]
*Linux Containers Discuss: [https://discuss.linuxcontainers.org/t/check-privileged-or-unprivileged/238 Check privileged or unprivileged]
* Mi blog lah!: [https://blog.simos.info/how-to-view-the-files-of-your-lxd-container-from-the-host/ How to view the files of your LXD container from the host]
* Mi blog lah!: [https://blog.simos.info/how-to-view-the-files-of-your-lxd-container-from-the-host/ How to view the files of your LXD container from the host]
* Server Fault: [https://serverfault.com/a/1036931/364207 '''How to migrate a regular LXC container to a Proxmox LXC container?''']


'''2.''' Copy the backup of an LXD/LXC container to a ProxmoxVM's template directory within its storage. In my case I'm using a command as the shown below.<syntaxhighlight lang="shell" line="1">
== Transfer the Container to the PVE Instance ==
Copy the backup of an LXD/LXC to a ProxmoxVE's template directory within its storage. In my case I'm using a command as the shown below.<syntaxhighlight lang="shell" line="1">
rsync --progress \
rsync --progress \
remote.host:/mnt/backups/lxc-webserver-backup-2022-09-23.tar.gz \
remote.host:/home/backups/lxc-webserver.tar.gz \
/mnt/pve/ssd-1TB/template/cache/
/mnt/pve/ssd-1TB/template/cache/
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:12, 23 September 2022

Con­vert­ing an LXD/LXC to a ProxmoxVE/​​​LXC is pret­ty easy, be­cause the are (al­most) the same thing.

Ex­port the Con­tain­er

Go in­to the in­stance where the LXD is in­stalled and cre­ate a back­up of the LXC you want to clone. If the con­tain­er is in­stalled with­in LVM you need to mount the root filesys­tem some­where and cre­ate the archive from in­side the mount point. I will go­ing to play the oth­er sce­nario where the LXC is in­stalled with­in a di­rec­to­ry on Ubun­tu 22.04.

lxc config show --expanded webserver | grep 'privileged'
security.privileged: "false"
cd /var/snap/lxd/common/lxd/storage-pools/default/containers/webserver/rootfs
tar --exclude=dev --exclude=sys --exclude=proc --exclude=tmp/* \
-czvf /home/backups/lxc-webserver.tar.gz ./

Note in the com­mands above:

  • web­serv­er is the name of the con­tain­er.
  • lxc-webserver.tar.gz is the name of the archive file of that con­tain­er.
Ref­er­ences

Trans­fer the Con­tain­er to the PVE In­stance

Copy the back­up of an LXD/LXC to a ProxmoxVE's tem­plate di­rec­to­ry with­in its stor­age. In my case I'm us­ing a com­mand as the shown be­low.

rsync --progress \
remote.host:/home/backups/lxc-webserver.tar.gz \
/mnt/pve/ssd-1TB/template/cache/

3.A. Af­ter that you can use