Skip to content

LUKS verschlüsselte Platte mounten

Linux
2 1 1.3k
  • Ich bin mal wieder am Spielen 🙂 Nachdem doch einiges schief gegangen ist, dazu später mehr, musste ich eine verschlüsselte NVMe SSD mal eben mounten um an ein paar Daten ran zu kommen.

    Pakete die benötigt werden

    apt install cryptsetup
    apt install lvm2
    

    Platte suchen

    root@frank-MS-7A34:~# blkid | grep crypto
    /dev/nvme0n1p3: UUID="abf46827-9c34-4ab5-a376-5e6344b4b164" TYPE="crypto_LUKS" PARTUUID="0552c66a-55cd-4153-bf01-787479575f0c"
    

    Platte entsperren

    root@frank-MS-7A34:~# cryptsetup luksOpen /dev/nvme0n1p3 crypthome
    Geben Sie die Passphrase für »/dev/nvme0n1p3« ein: 
    

    Mount Verzeichnis anlegen

    mkdir /mnt/crypthome
    

    /dev/mapper anzeigen

    root@frank-MS-7A34:~# fdisk -l
    [..gekürzt..]
    Festplatte /dev/mapper/crypthome: 476,19 GiB, 511299289088 Bytes, 998631424 Sektoren
    Einheiten: Sektoren von 1 * 512 = 512 Bytes
    Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
    E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
    
    
    Festplatte /dev/mapper/debian--vg-root: 444,24 GiB, 476988833792 Bytes, 931618816 Sektoren
    Einheiten: Sektoren von 1 * 512 = 512 Bytes
    Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
    E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
    
    
    Festplatte /dev/mapper/debian--vg-swap_1: 31,98 GiB, 34309406720 Bytes, 67010560 Sektoren
    Einheiten: Sektoren von 1 * 512 = 512 Bytes
    Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
    E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
    

    Das Root Verzeichnis möchte ich mounten.

    Mounten

    root@frank-MS-7A34:~# mount /dev/mapper/debian--vg-root /mnt/crypthome
    

    Fertig!

    Bildschirmfoto vom 2020-05-01 13-43-06.png

    Quelle: https://evilshit.wordpress.com/2012/10/29/how-to-mount-luks-encrypted-partitions-manually/

  • So, jetzt das ganze noch einen Ticken komplizierter 🙂

    Ich habe ja heute, für eine Neuinstallation von Ubuntu 20.04 Focal eine zweite NVMe SSD eingebaut. Meinen Bericht zu dem Thema findet ihr hier. Aber, darum soll es jetzt hier nicht gehen.

    Wir haben jetzt zwei verschlüsselte Ubuntu NVMe SSD Riegel im System. Jetzt klappt die ganze Sache da oben nicht mehr. Es kommt immer einen Fehlermeldung.

    unbekannter Dateisystemtyp „LVM2_member“.
    

    Ok, kurz googlen und dann findet man heraus, das es nicht klappen kann, weil beide LVM Gruppen, den selben Namen benutzen.

    root@frank-MS-7C37:/mnt/crypthome/root# vgdisplay
      --- Volume group ---
      VG Name               vgubuntu2
      System ID             
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  4
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               1
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               <464,53 GiB
      PE Size               4,00 MiB
      Total PE              118919
      Alloc PE / Size       118919 / <464,53 GiB
      Free  PE / Size       0 / 0   
      VG UUID               lpZxyv-cNOS-ld2L-XgvG-QILa-caHS-AaIC3A
       
      --- Volume group ---
      VG Name               vgubuntu
      System ID             
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               <475,71 GiB
      PE Size               4,00 MiB
      Total PE              121781
      Alloc PE / Size       121781 / <475,71 GiB
      Free  PE / Size       0 / 0   
      VG UUID               jRYTXL-zjpY-lYr6-KODT-u0LJ-9fYf-YVDna7
    

    Hier oben sieht man das schon mit geändertem Namen. Der VG Name muss unterschiedlich sein. Auch dafür gibt es ein Tool.

    root@frank-MS-7C37:/mnt/crypthome/root# vgrename --help
      vgrename - Rename a volume group
    
      Rename a VG.
      vgrename VG VG_new
    	[ COMMON_OPTIONS ]
    
      Rename a VG by specifying the VG UUID.
      vgrename String VG_new
    	[ COMMON_OPTIONS ]
    
      Common options for command:
    	[ -A|--autobackup y|n ]
    	[ -f|--force ]
    	[    --reportformat basic|json ]
    
      Common options for lvm:
    	[ -d|--debug ]
    	[ -h|--help ]
    	[ -q|--quiet ]
    	[ -v|--verbose ]
    	[ -y|--yes ]
    	[ -t|--test ]
    	[    --commandprofile String ]
    	[    --config String ]
    	[    --driverloaded y|n ]
    	[    --nolocking ]
    	[    --lockopt String ]
    	[    --longhelp ]
    	[    --profile String ]
    	[    --version ]
    
      Use --longhelp to show all options and advanced commands.
    

    Das muss dann so aussehen!

    vgrename lpZxyv-cNOS-ld2L-XgvG-QILa-caHS-AaIC3A vgubuntu2
    

    ACHTUNG

    Es kann zu Datenverlust kommen, also wie immer, Hirn einschalten!

    Ich weiß, das die erste eingebaute Platte mit der Nummer /dev/nvme0n1 geführt wird. Die zweite, heute verbaute, hört dann auf den Namen /dev/nvme1n1. Die darf ich nicht anpacken, weil sonst das System nicht mehr startet.

    /etc/fstab

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    /dev/mapper/vgubuntu-root /               ext4    errors=remount-ro 0       1
    # /boot was on /dev/nvme1n1p2 during installation
    UUID=178c7e51-a1d7-4ead-bbdf-a956eb7b754f /boot           ext4    defaults        0       2
    # /boot/efi was on /dev/nvme0n1p1 during installation
    UUID=7416-4553  /boot/efi       vfat    umask=0077      0       1
    /dev/mapper/vgubuntu-swap_1 none            swap    sw              0       0
    

    Jo, wenn jetzt die Partition /dev/mapper/vgubuntu2-root / anstatt /dev/mapper/vgubuntu-root / heißt läuft nichts mehr. Nur um das zu verdeutlichen, auch das könnte man problemlos reparieren. Aber, ich möchte nur warnen!!

    Nachdem die Änderung durchgeführt wurde, habe ich den Rechner neugestartet. Puuh, Glück gehabt, richtige NVMe SSD erwischt 🙂

    Festplatte /dev/mapper/vgubuntu2-root: 463,58 GiB, 497754832896 Bytes, 972177408 Sektoren
    Einheiten: Sektoren von 1 * 512 = 512 Bytes
    Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
    E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
    

    Nun können wir die Platte ganz normal, wie oben beschrieben, mounten. Nun kann ich noch ein paar Dinge kopieren 😉

  • Update 1.34.1

    Vaultwarden vaultwarden linux
    1
    0 Stimmen
    1 Beiträge
    86 Aufrufe
    Niemand hat geantwortet
  • VSCodium - Meldungen trailing-whitespaces

    Linux vscodium vscode linux
    1
    3
    0 Stimmen
    1 Beiträge
    144 Aufrufe
    Niemand hat geantwortet
  • ZFS - Wichtige Befehle

    Linux zfs linux
    3
    0 Stimmen
    3 Beiträge
    1k Aufrufe
    FrankMF
    Heute mal drüber gestolpert, das es auch so was geben kann. root@pve2:~# zpool status pool: pool_NAS state: ONLINE status: Some supported and requested features are not enabled on the pool. The pool can still be used, but some features are unavailable. action: Enable all features using 'zpool upgrade'. Once this is done, the pool may no longer be accessible by software that does not support the features. See zpool-features(7) for details. scan: scrub repaired 0B in 00:20:50 with 0 errors on Sun Apr 13 00:44:51 2025 config: NAME STATE READ WRITE CKSUM pool_NAS ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ata-WDC_WDS100T1R0A-68A4W0_230520800733 ONLINE 0 0 0 ata-WDC_WDS100T1R0A-68A4W0_230520801376 ONLINE 0 0 0 errors: No known data errors Was machen? Als erstes mal ein Backup angestoßen. Danach root@pve2:~# zpool get all pool_NAS | grep feature pool_NAS feature@async_destroy enabled local pool_NAS feature@empty_bpobj active local pool_NAS feature@lz4_compress active local pool_NAS feature@multi_vdev_crash_dump enabled local pool_NAS feature@spacemap_histogram active local pool_NAS feature@enabled_txg active local pool_NAS feature@hole_birth active local pool_NAS feature@extensible_dataset active local pool_NAS feature@embedded_data active local pool_NAS feature@bookmarks enabled local pool_NAS feature@filesystem_limits enabled local pool_NAS feature@large_blocks enabled local pool_NAS feature@large_dnode enabled local pool_NAS feature@sha512 enabled local pool_NAS feature@skein enabled local pool_NAS feature@edonr enabled local pool_NAS feature@userobj_accounting active local pool_NAS feature@encryption enabled local pool_NAS feature@project_quota active local pool_NAS feature@device_removal enabled local pool_NAS feature@obsolete_counts enabled local pool_NAS feature@zpool_checkpoint enabled local pool_NAS feature@spacemap_v2 active local pool_NAS feature@allocation_classes enabled local pool_NAS feature@resilver_defer enabled local pool_NAS feature@bookmark_v2 enabled local pool_NAS feature@redaction_bookmarks enabled local pool_NAS feature@redacted_datasets enabled local pool_NAS feature@bookmark_written enabled local pool_NAS feature@log_spacemap active local pool_NAS feature@livelist enabled local pool_NAS feature@device_rebuild enabled local pool_NAS feature@zstd_compress enabled local pool_NAS feature@draid enabled local pool_NAS feature@zilsaxattr disabled local pool_NAS feature@head_errlog disabled local pool_NAS feature@blake3 disabled local pool_NAS feature@block_cloning disabled local pool_NAS feature@vdev_zaps_v2 disabled local Das kommt von neuen Funktionen, die zu ZFS hinzugefügt wurden und bei Erstellung des Pools nicht vorhanden waren. Dann upgraden wir mal root@pve2:~# zpool upgrade pool_NAS This system supports ZFS pool feature flags. Enabled the following features on 'pool_NAS': zilsaxattr head_errlog blake3 block_cloning vdev_zaps_v2 Kontrolle root@pve2:~# zpool status pool: pool_NAS state: ONLINE scan: scrub repaired 0B in 00:20:50 with 0 errors on Sun Apr 13 00:44:51 2025 config: NAME STATE READ WRITE CKSUM pool_NAS ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ata-WDC_WDS100T1R0A-68A4W0_230520800733 ONLINE 0 0 0 ata-WDC_WDS100T1R0A-68A4W0_230520801376 ONLINE 0 0 0 errors: No known data errors Features kontrollieren root@pve2:~# zpool get all pool_NAS | grep feature pool_NAS feature@async_destroy enabled local pool_NAS feature@empty_bpobj active local pool_NAS feature@lz4_compress active local pool_NAS feature@multi_vdev_crash_dump enabled local pool_NAS feature@spacemap_histogram active local pool_NAS feature@enabled_txg active local pool_NAS feature@hole_birth active local pool_NAS feature@extensible_dataset active local pool_NAS feature@embedded_data active local pool_NAS feature@bookmarks enabled local pool_NAS feature@filesystem_limits enabled local pool_NAS feature@large_blocks enabled local pool_NAS feature@large_dnode enabled local pool_NAS feature@sha512 enabled local pool_NAS feature@skein enabled local pool_NAS feature@edonr enabled local pool_NAS feature@userobj_accounting active local pool_NAS feature@encryption enabled local pool_NAS feature@project_quota active local pool_NAS feature@device_removal enabled local pool_NAS feature@obsolete_counts enabled local pool_NAS feature@zpool_checkpoint enabled local pool_NAS feature@spacemap_v2 active local pool_NAS feature@allocation_classes enabled local pool_NAS feature@resilver_defer enabled local pool_NAS feature@bookmark_v2 enabled local pool_NAS feature@redaction_bookmarks enabled local pool_NAS feature@redacted_datasets enabled local pool_NAS feature@bookmark_written enabled local pool_NAS feature@log_spacemap active local pool_NAS feature@livelist enabled local pool_NAS feature@device_rebuild enabled local pool_NAS feature@zstd_compress enabled local pool_NAS feature@draid enabled local pool_NAS feature@zilsaxattr enabled local pool_NAS feature@head_errlog active local pool_NAS feature@blake3 enabled local pool_NAS feature@block_cloning enabled local pool_NAS feature@vdev_zaps_v2 enabled local So, alle neuen Features aktiviert. Jetzt kann der Pool weiterhin seine Arbeit machen.
  • ZFS - One Disk Pool -> Mirror Pool

    Linux linux zfs
    1
    0 Stimmen
    1 Beiträge
    207 Aufrufe
    Niemand hat geantwortet
  • checkmk - Apache2 vs. NGINX

    checkmk checkmk linux
    2
    0 Stimmen
    2 Beiträge
    839 Aufrufe
    FrankMF
    Ich musste am Ende wieder den Apachen installieren, da checkmk zu viele Abhängigkeiten hat. So was wie omd-apache2(?), wurde mir dann als Fehler angezeigt. Die Server waren auf einmal offline usw. Schade, aber letztendlich für den Container auch egal. Oben im Apachen die SSL Sicherheit erhöht. [image: 1632559940229-4ba2853c-d5a3-422d-b787-b9f66256b511-grafik.png]
  • FreeOTP+

    Linux linux freeotp+
    3
    1
    0 Stimmen
    3 Beiträge
    662 Aufrufe
    FrankMF
    Falls mal jemand von FreeOTP+ zum Bitwarden Authenticator wechseln möchte, ich habe da mal was gebaut https://forgejo.linux-nerds.org/frank/freeotpplus-export-to-bitwarden-authenticator
  • OpenWrt - Sysupgrade

    OpenWRT & Ubiquiti ER-X openwrt linux er-x
    1
    0 Stimmen
    1 Beiträge
    286 Aufrufe
    Niemand hat geantwortet
  • Liste von Linuxbefehlen

    Angeheftet Linux linux
    5
    1
    0 Stimmen
    5 Beiträge
    1k Aufrufe
    FrankMF
    Kurzer IPv6 Ping, ohne viel Tipparbeit root@:~# ping 2600:: PING 2600::(2600::) 56 data bytes 64 bytes from 2600::: icmp_seq=1 ttl=55 time=14.9 ms 64 bytes from 2600::: icmp_seq=2 ttl=55 time=13.0 ms 64 bytes from 2600::: icmp_seq=3 ttl=55 time=15.9 ms