{"id":8422,"date":"2025-10-28T15:48:03","date_gmt":"2025-10-28T14:48:03","guid":{"rendered":"https:\/\/speefak.spdns.de\/oss_lifestyle\/?p=8422"},"modified":"2025-12-01T14:32:53","modified_gmt":"2025-12-01T13:32:53","slug":"klon-eines-luks-systems-in-eine-unverschluesselte-vm","status":"publish","type":"post","link":"https:\/\/speefak.spdns.de\/oss_lifestyle\/klon-eines-luks-systems-in-eine-unverschluesselte-vm\/","title":{"rendered":"Klon eines LUKS-Systems in eine unverschl\u00fcsselte VM"},"content":{"rendered":"<p>Die LUKS-Verschl\u00fcsselung eines Linux-Systems kann aufgehoben werden, indem man die Inhalte in eine unverschl\u00fcsselte VM kopiert. Dieses Tutorial beschreibt, wie man ein verschl\u00fcsseltes Debian-System <strong>per SSHFS \u00fcber LAN<\/strong> in eine virtuelle Maschine (VM) klont \u2014 z. B. f\u00fcr <strong>tempor\u00e4re Backups oder Tests<\/strong>.<\/p>\n<hr \/>\n<h2><strong>1\ufe0f\u20e3 Vorbereitung im Zielsystem (VM)<\/strong><\/h2>\n<p>Booten mit <strong>Debian Live-System<\/strong>, danach:<\/p>\n<pre class=\"\">sudo apt update\r\nsudo apt install -y gparted openssh-server\r\nsudo passwd root\r\n<\/pre>\n<p>SSH-Root-Login aktivieren:<\/p>\n<pre>nano \/etc\/ssh\/sshd_config\r\n<\/pre>\n<p>\u00c4ndere bzw. f\u00fcge hinzu:<\/p>\n<pre class=\"\">PermitRootLogin yes\r\n<\/pre>\n<p>Dann Dienst neu starten:<\/p>\n<pre class=\"\">systemctl restart ssh\r\n<\/pre>\n<hr \/>\n<h2><strong>2\ufe0f\u20e3 Partitionen in der VM anlegen und mounten<\/strong><\/h2>\n<p>Mit <strong>gparted<\/strong> gew\u00fcnschte Partitionierung erstellen, z. B.:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><code>\/dev\/sda1<\/code> \u2192 <strong>\/boot<\/strong><\/li>\n<li><code>\/dev\/sda2<\/code> \u2192 <strong>\/<\/strong> (root)<\/li>\n<li><code>\/dev\/sda3<\/code> \u2192 <strong>\/home<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Danach mounten:<\/p>\n<pre class=\"\">sudo mkdir -p \/mnt\/target \/mnt\/target\/home \/mnt\/target\/boot\r\nsleep 2\r\nsudo mount \/dev\/sda2 \/mnt\/target\r\nsudo mount \/dev\/sda3 \/mnt\/target\/home\r\nsudo mount \/dev\/sda1 \/mnt\/target\/boot\r\n<\/pre>\n<hr \/>\n<h2><strong>3\ufe0f\u20e3 SSH-Zugriff vorbereiten<\/strong><\/h2>\n<p>VM-IP herausfinden:<\/p>\n<pre class=\"\">ip -a\r\n<\/pre>\n<p>Dann im Quellsystem setzen:<\/p>\n<pre class=\"lang:default decode:true\">VM_IP=192.168.1.57  # IP von Zielsystem (Ziel-VM)\r\n<\/pre>\n<h3><strong>SSH-Verbindung testen:<\/strong><\/h3>\n<pre class=\"lang:default decode:true\">ssh root@&amp;VM_IP -t -t exit &amp;&amp; echo \"\u2705 SSH-Verbindung erfolgreich.\" || { echo \"\u274c SSH-Verbindung fehlgeschlagen!\"; exit 1; }\r\n<\/pre>\n<hr \/>\n<h2><strong>4\ufe0f\u20e3 SSHFS-Verbindungen zur VM herstellen<\/strong><\/h2>\n<p>Im <strong>Quellsystem<\/strong>:<\/p>\n<pre class=\"\">sudo mkdir -p \/mnt\/vm-root \/mnt\/vm-home \/mnt\/vm-boot\r\n\r\nsudo sshfs root@$VM_IP:\/mnt\/target       \/mnt\/vm-root\r\nsudo sshfs root@$VM_IP:\/mnt\/target\/home  \/mnt\/vm-home\r\nsudo sshfs root@$VM_IP:\/mnt\/target\/boot  \/mnt\/vm-boot\r\n<\/pre>\n<hr \/>\n<h2><strong>5\ufe0f\u20e3 Daten\u00fcbertragung per rsync<\/strong><\/h2>\n<p>Im Quellsystem:<\/p>\n<pre class=\"\">sudo rsync -aAXHv --delete \/boot\/  \/mnt\/vm-boot\/\r\nsudo rsync -aAXHv --delete \/home\/  \/mnt\/vm-home\/\r\nsudo rsync -aAXHv --delete --exclude={\"\/boot\/*\",\"\/home\/*\",\"\/dev\/*\",\"\/proc\/*\",\"\/sys\/*\",\"\/tmp\/*\",\"\/run\/*\",\"\/mnt\/*\",\"\/media\/*\",\"\/lost+found\"} \/ \/mnt\/vm-root\/\r\n<\/pre>\n<hr \/>\n<h2><strong>6\ufe0f\u20e3 GRUB installieren (in der VM)<\/strong><\/h2>\n<p>Nach Abschluss der \u00dcbertragung in der <strong>Ziel-VM (nicht im Quellsystem!)<\/strong>:<\/p>\n<pre class=\"\">mount --bind \/dev \/mnt\/target\/dev\r\nmount --bind \/proc \/mnt\/target\/proc\r\nmount --bind \/sys \/mnt\/target\/sys\r\nchroot \/mnt\/target\r\n\r\nGRUB installieren:<\/pre>\n<pre class=\"\">grub-install \/dev\/sda\r\nupdate-grub\r\n<\/pre>\n<hr \/>\n<h2><strong>7\ufe0f\u20e3 Nachbearbeitung \u2013 alte LUKS-Eintr\u00e4ge entfernen<\/strong><\/h2>\n<h3><strong>7.1 \/etc\/crypttab leeren<\/strong><\/h3>\n<pre class=\"\">nano \/etc\/crypttab\r\n\r\n\u27a1 Datei <strong>leeren oder alle Zeilen auskommentieren<\/strong>, z. B.:<\/pre>\n<pre class=\"\"># keine LUKS-Ger\u00e4te mehr vorhanden\r\n<\/pre>\n<hr \/>\n<h3><strong>7.2 \/etc\/fstab anpassen<\/strong><\/h3>\n<p>Mit <code>lsblk -f<\/code> oder <code>blkid<\/code> neue UUIDs anzeigen und in <code>\/etc\/fstab<\/code> eintragen:<\/p>\n<pre class=\"\">nano \/etc\/fstab\r\n\r\nBeispiel:<\/pre>\n<pre class=\"lang:default decode:true\">UUID=&lt;uuid-sda2&gt; \/ ext4 defaults 0 1\r\nUUID=&lt;uuid-sda1&gt; \/boot ext4 defaults 0 2\r\nUUID=&lt;uuid-sda3&gt; \/home ext4 defaults 0<\/pre>\n<hr \/>\n<h3><strong>7.3 Resume-Datei bereinigen<\/strong><\/h3>\n<pre class=\"\">nano \/etc\/initramfs-tools\/conf.d\/resume\r\n<\/pre>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Keine Swap-Partition in VM<\/strong> \u2192<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"\">RESUME=none\r\n<\/pre>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Neue Swap-Partition<\/strong> \u2192 UUID der Swap-Partition eintragen, z. B.:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"\">RESUME=UUID=3214bdca-570a-472c-8e0f-e29ad6defa63\r\n<\/pre>\n<p>Danach:<\/p>\n<pre class=\"\">update-initramfs -u -k all\r\n<\/pre>\n<hr \/>\n<h3><strong>7.4 Swap-Referenzfehler beseitigen<\/strong><\/h3>\n<p>Wenn beim Booten Fehler wie erscheinen:<\/p>\n<pre class=\"\">cryptsetup: ERROR: Couldn't resolve device \/dev\/mapper\/D12--System-Swap\r\n<\/pre>\n<p>dann:<\/p>\n<ol>\n<li>Alte Swap-Zeilen in <code>\/etc\/fstab<\/code> l\u00f6schen oder auskommentieren:<\/li>\n<\/ol>\n<pre class=\"\">\/dev\/mapper\/D12--System-Swap none swap sw 0 0\r\n<\/pre>\n<ol start=\"2\">\n<li>Optional neue Swap-Partition eintragen.<\/li>\n<li>Initramfs neu erstellen:<\/li>\n<\/ol>\n<pre class=\"\">update-initramfs -u -k all\r\n<\/pre>\n<hr \/>\n<h2><strong>8\ufe0f\u20e3 Initramfs &amp; GRUB final aktualisieren<\/strong><\/h2>\n<pre class=\"\">update-initramfs -u -k all\r\nupdate-grub\r\ngrub-install \/dev\/sda\r\nexit\r\numount -R \/mnt\/target\r\nreboot\r\n<\/pre>\n<hr \/>\n<p>\u2705 <strong>Fertig!<\/strong><br \/>\nDie VM startet nun <strong>ohne LUKS<\/strong>, <strong>ohne Swap-bezogene Bootfehler<\/strong>, und ist vollst\u00e4ndig funktionsf\u00e4hig.<\/p>\n<hr \/>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2821 alignleft\" src=\"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-content\/uploads\/2014\/08\/CC_BY_NC_SA.png\" alt=\"CC_BY_NC_SA\" width=\"65\" height=\"23\" \/>Speefak<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Die LUKS-Verschl\u00fcsselung eines Linux-Systems kann aufgehoben werden, indem man die Inhalte in eine unverschl\u00fcsselte VM kopiert. Dieses Tutorial beschreibt, wie man ein verschl\u00fcsseltes Debian-System per SSHFS \u00fcber LAN in eine virtuelle Maschine (VM) klont \u2014 z. B. f\u00fcr tempor\u00e4re Backups oder Tests. 1\ufe0f\u20e3 Vorbereitung im Zielsystem (VM) Booten mit Debian Live-System, danach: sudo apt update [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,46],"tags":[],"class_list":["post-8422","post","type-post","status-publish","format-standard","hentry","category-anleitungen","category-virtualisierung"],"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"speefak","author_link":"https:\/\/speefak.spdns.de\/oss_lifestyle\/author\/speefak_oss\/"},"rttpg_comment":0,"rttpg_category":"<a href=\"https:\/\/speefak.spdns.de\/oss_lifestyle\/category\/anleitungen\/\" rel=\"category tag\">Anleitungen<\/a> <a href=\"https:\/\/speefak.spdns.de\/oss_lifestyle\/category\/virtualisierung\/\" rel=\"category tag\">Virtualisierung<\/a>","rttpg_excerpt":"Die LUKS-Verschl\u00fcsselung eines Linux-Systems kann aufgehoben werden, indem man die Inhalte in eine unverschl\u00fcsselte VM kopiert. Dieses Tutorial beschreibt, wie man ein verschl\u00fcsseltes Debian-System per SSHFS \u00fcber LAN in eine virtuelle Maschine (VM) klont \u2014 z. B. f\u00fcr tempor\u00e4re Backups oder Tests. 1\ufe0f\u20e3 Vorbereitung im Zielsystem (VM) Booten mit Debian Live-System, danach: sudo apt update&hellip;","_links":{"self":[{"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/posts\/8422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/comments?post=8422"}],"version-history":[{"count":0,"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/posts\/8422\/revisions"}],"wp:attachment":[{"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/media?parent=8422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/categories?post=8422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/speefak.spdns.de\/oss_lifestyle\/wp-json\/wp\/v2\/tags?post=8422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}