{"id":300,"date":"2024-11-20T12:59:50","date_gmt":"2024-11-20T12:59:50","guid":{"rendered":"https:\/\/www.beer.org\/blog\/?p=300"},"modified":"2024-11-23T13:51:34","modified_gmt":"2024-11-23T13:51:34","slug":"re-create-proxmox-containers-and-vms-from-existing-raw-images","status":"publish","type":"post","link":"https:\/\/www.beer.org\/blog\/index.php\/2024\/11\/20\/re-create-proxmox-containers-and-vms-from-existing-raw-images\/","title":{"rendered":"Re-create proxmox containers and VM&#8217;s from existing raw images."},"content":{"rendered":"<ul>\n<li>Find your backups.<\/li>\n<li>Extract pct.conf from backups\n<ul>\n<li>tar xvf \/mnt2\/mpv-pve\/dump\/vzdump-lxc-101-2024_11_16-00_03_50.tar.lzo .\/etc\/vzdump<\/li>\n<\/ul>\n<\/li>\n<li>Create null_template.tar.gz<\/li>\n<\/ul>\n<pre>for I in 105 103 102 101; do cat $I\/etc\/vzdump\/pct.conf | grep -v ^lxc | grep -v \"^#\" | sed -e 's\/^\/\\-\/' -e 's\/: \/ \/' | xargs pct create $I \/mnt\/pve\/nfs-beernas-containers\/template\/cache\/null_template.tar.gz; done<\/pre>\n<pre>for I in 100 120 121 122; do mkdir -p \/tmp\/$I; lzop -dc vzdump-qemu-$I-*.lzo | vma config - &gt; \/tmp\/$I\/$I.conf; done\r\nfor I in 100 120 121 122; do cat \/tmp\/$I\/$I.conf | grep -v '#' | sed -e 's\/: \/ \/' -e 's\/^\/\\-\/' | xargs qm create $I; done<\/pre>\n<p>&#8230;and to avoid this pain in the future:<\/p>\n<blockquote>\n<pre>5 0 * * 0 touch \/mnt\/pve\/nfs-beernas-backups\/.timestamp\r\n0 0 * * 0 find \/mnt\/pve\/nfs-beernas-backups -name config.dump.* \\! -newer \/mnt\/pve\/nfs-beernas-backups\/.timestamp -print | xargs rm\r\n0 0 * * * sqlite3 \/var\/lib\/pve-cluster\/config.db .dump &gt; \/mnt\/pve\/nfs-beernas-backups\/config.dump.$(date --utc +%Z%Y%m%d%H%M%S).sql<\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Find your backups. Extract pct.conf from backups tar xvf \/mnt2\/mpv-pve\/dump\/vzdump-lxc-101-2024_11_16-00_03_50.tar.lzo .\/etc\/vzdump Create null_template.tar.gz for I in 105 103 102 101; do cat $I\/etc\/vzdump\/pct.conf | grep -v ^lxc | grep -v &#8220;^#&#8221; | sed -e &#8216;s\/^\/\\-\/&#8217; -e &#8216;s\/: \/ \/&#8217; | xargs pct create $I \/mnt\/pve\/nfs-beernas-containers\/template\/cache\/null_template.tar.gz; done for I in 100 120 121 122; do mkdir&#8230; <a class=\"moretag\" href=\"https:\/\/www.beer.org\/blog\/index.php\/2024\/11\/20\/re-create-proxmox-containers-and-vms-from-existing-raw-images\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-300","post","type-post","status-publish","format-standard","hentry","category-tech-stuff"],"_links":{"self":[{"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=300"}],"version-history":[{"count":5,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/300\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/300\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beer.org\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}