[{"data":1,"prerenderedAt":1276},["ShallowReactive",2],{"navigation_docs_en":3,"-en-nonsense-bash-luks-backup-":377,"-en-nonsense-bash-luks-backup--surround":1271},[4,16,94,262,271,332],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":15},"About","i-noto-star","\u002Fen\u002Fabout","en\u002F1.about",[10],{"title":11,"path":12,"stem":13,"icon":14},"Welcome","\u002Fen\u002Fabout\u002Fwelcome","en\u002F1.about\u002F1.welcome","i-lucide-home",false,{"title":17,"icon":18,"path":19,"stem":20,"children":21,"page":15},"General","i-noto-open-book","\u002Fen\u002Fgeneral","en\u002F2.general",[22,26,44,58,76],{"title":17,"path":23,"stem":24,"icon":25},"\u002Fen\u002Fgeneral\u002Fsummary","en\u002F2.general\u002F1.summary","i-lucide-bookmark",{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":15},"Networking","i-lucide-network","\u002Fen\u002Fgeneral\u002Fnetworking","en\u002F2.general\u002F2.networking",[32,36,40],{"title":33,"path":34,"stem":35},"NAT & DHCP","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fnat","en\u002F2.general\u002F2.networking\u002F1.nat",{"title":37,"path":38,"stem":39},"DNS Zone","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fdns","en\u002F2.general\u002F2.networking\u002F2.dns",{"title":41,"path":42,"stem":43},"Samba","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fsamba","en\u002F2.general\u002F2.networking\u002F3.samba",{"title":45,"icon":46,"path":47,"stem":48,"children":49,"page":15},"Storage","i-lucide-hard-drive","\u002Fen\u002Fgeneral\u002Fstorage","en\u002F2.general\u002F3.storage",[50,54],{"title":51,"path":52,"stem":53},"RAID","\u002Fen\u002Fgeneral\u002Fstorage\u002Fraid","en\u002F2.general\u002F3.storage\u002F1.raid",{"title":55,"path":56,"stem":57},"ZFS","\u002Fen\u002Fgeneral\u002Fstorage\u002Fzfs","en\u002F2.general\u002F3.storage\u002F2.zfs",{"title":59,"icon":60,"path":61,"stem":62,"children":63,"page":15},"Hardware","i-lucide-server","\u002Fen\u002Fgeneral\u002Fhardware","en\u002F2.general\u002F4.hardware",[64,68,72],{"title":65,"path":66,"stem":67},"The Basics","\u002Fen\u002Fgeneral\u002Fhardware\u002Fbasics","en\u002F2.general\u002F4.hardware\u002F1.basics",{"title":69,"path":70,"stem":71},"Network","\u002Fen\u002Fgeneral\u002Fhardware\u002Fnetwork","en\u002F2.general\u002F4.hardware\u002F2.network",{"title":73,"path":74,"stem":75},"The ProloNAS","\u002Fen\u002Fgeneral\u002Fhardware\u002Fprolonas","en\u002F2.general\u002F4.hardware\u002F3.prolonas",{"title":77,"icon":78,"path":79,"stem":80,"children":81,"page":15},"Linux tips for dummies","i-lucide-terminal","\u002Fen\u002Fgeneral\u002Flinux","en\u002F2.general\u002F5.linux",[82,86,90],{"title":83,"path":84,"stem":85},"Command line basics","\u002Fen\u002Fgeneral\u002Flinux\u002Fcli-basics","en\u002F2.general\u002F5.linux\u002F1.cli-basics",{"title":87,"path":88,"stem":89},"Folders and partitions","\u002Fen\u002Fgeneral\u002Flinux\u002Ffilesystem","en\u002F2.general\u002F5.linux\u002F2.filesystem",{"title":91,"path":92,"stem":93},"Handy CLI tools","\u002Fen\u002Fgeneral\u002Flinux\u002Fhandy-tools","en\u002F2.general\u002F5.linux\u002F3.handy-tools",{"title":95,"icon":96,"path":97,"stem":98,"children":99,"page":15},"Serveex","i-noto-microscope","\u002Fen\u002Fserveex","en\u002F3.serveex",[100,104,126,144,170,188,202,216,234,248],{"title":101,"path":102,"stem":103,"icon":25},"Introduction","\u002Fen\u002Fserveex\u002Fintroduction","en\u002F3.serveex\u002F1.introduction",{"title":105,"icon":106,"path":107,"stem":108,"children":109,"page":15},"Server core","i-lucide-server-cog","\u002Fen\u002Fserveex\u002Fcore","en\u002F3.serveex\u002F2.core",[110,114,118,122],{"title":111,"path":112,"stem":113},"Debian 13","\u002Fen\u002Fserveex\u002Fcore\u002Finstallation","en\u002F3.serveex\u002F2.core\u002F1.installation",{"title":115,"path":116,"stem":117},"Docker","\u002Fen\u002Fserveex\u002Fcore\u002Fdocker","en\u002F3.serveex\u002F2.core\u002F2.docker",{"title":119,"path":120,"stem":121},"Wireguard","\u002Fen\u002Fserveex\u002Fcore\u002Fwireguard","en\u002F3.serveex\u002F2.core\u002F3.wireguard",{"title":123,"path":124,"stem":125},"SWAG","\u002Fen\u002Fserveex\u002Fcore\u002Fswag","en\u002F3.serveex\u002F2.core\u002F4.swag",{"title":127,"icon":128,"path":129,"stem":130,"children":131,"page":15},"Security","i-lucide-shield","\u002Fen\u002Fserveex\u002Fsecurity","en\u002F3.serveex\u002F3.security",[132,136,140],{"title":133,"path":134,"stem":135},"Cloudflare Zero Trust","\u002Fen\u002Fserveex\u002Fsecurity\u002Fcloudflare","en\u002F3.serveex\u002F3.security\u002F2.cloudflare",{"title":137,"path":138,"stem":139},"TinyAuth","\u002Fen\u002Fserveex\u002Fsecurity\u002Ftinyauth","en\u002F3.serveex\u002F3.security\u002F3.tinyauth",{"title":141,"path":142,"stem":143},"Pocket ID","\u002Fen\u002Fserveex\u002Fsecurity\u002Fpocket-id","en\u002F3.serveex\u002F3.security\u002F4.pocket-id",{"title":145,"icon":146,"path":147,"stem":148,"children":149,"page":15},"Monitoring","i-lucide-chart-no-axes-column","\u002Fen\u002Fserveex\u002Fmonitoring","en\u002F3.serveex\u002F4.monitoring",[150,154,158,162,166],{"title":151,"path":152,"stem":153},"Uptime-Kuma","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fuptime-kuma","en\u002F3.serveex\u002F4.monitoring\u002F1.uptime-kuma",{"title":155,"path":156,"stem":157},"Dozzle","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fdozzle","en\u002F3.serveex\u002F4.monitoring\u002F2.dozzle",{"title":159,"path":160,"stem":161},"Speedtest Tracker","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fspeedtest-tracker","en\u002F3.serveex\u002F4.monitoring\u002F3.speedtest-tracker",{"title":163,"path":164,"stem":165},"Beszel","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fbeszel","en\u002F3.serveex\u002F4.monitoring\u002F4.beszel",{"title":167,"path":168,"stem":169},"UpSnap","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fupsnap","en\u002F3.serveex\u002F4.monitoring\u002F5.upsnap",{"title":171,"icon":172,"path":173,"stem":174,"children":175,"page":15},"Media & Seedbox","i-lucide-list-video","\u002Fen\u002Fserveex\u002Fmedia","en\u002F3.serveex\u002F5.media",[176,180,184],{"title":177,"path":178,"stem":179},"Jellyfin","\u002Fen\u002Fserveex\u002Fmedia\u002Fjellyfin","en\u002F3.serveex\u002F5.media\u002F1.jellyfin",{"title":181,"path":182,"stem":183},"Qbittorrent","\u002Fen\u002Fserveex\u002Fmedia\u002Fqbittorrent","en\u002F3.serveex\u002F5.media\u002F2.qbittorrent",{"title":185,"path":186,"stem":187},"Automation","\u002Fen\u002Fserveex\u002Fmedia\u002Fservarr","en\u002F3.serveex\u002F5.media\u002F3.servarr",{"title":189,"icon":190,"path":191,"stem":192,"children":193,"page":15},"Cloud Drive & Photos","i-lucide-cloud-upload","\u002Fen\u002Fserveex\u002Fcloud","en\u002F3.serveex\u002F6.cloud",[194,198],{"title":195,"path":196,"stem":197},"Immich","\u002Fen\u002Fserveex\u002Fcloud\u002Fimmich","en\u002F3.serveex\u002F6.cloud\u002F1.immich",{"title":199,"path":200,"stem":201},"Nextcloud","\u002Fen\u002Fserveex\u002Fcloud\u002Fnextcloud","en\u002F3.serveex\u002F6.cloud\u002F2.nextcloud",{"title":203,"icon":204,"path":205,"stem":206,"children":207,"page":15},"File & share","i-lucide-folder-tree","\u002Fen\u002Fserveex\u002Ffiles","en\u002F3.serveex\u002F7.files",[208,212],{"title":209,"path":210,"stem":211},"File Browser Quantum","\u002Fen\u002Fserveex\u002Ffiles\u002Ffile-browser-quantum","en\u002F3.serveex\u002F7.files\u002F1.file-browser-quantum",{"title":213,"path":214,"stem":215},"Pingvin","\u002Fen\u002Fserveex\u002Ffiles\u002Fpingvin","en\u002F3.serveex\u002F7.files\u002F2.pingvin",{"title":217,"icon":218,"path":219,"stem":220,"children":221,"page":15},"Developpement","i-lucide-code-xml","\u002Fen\u002Fserveex\u002Fdevelopment","en\u002F3.serveex\u002F8.development",[222,226,230],{"title":223,"path":224,"stem":225},"Code-Server","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fcode-server","en\u002F3.serveex\u002F8.development\u002F1.code-server",{"title":227,"path":228,"stem":229},"Forgejo","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fforgejo","en\u002F3.serveex\u002F8.development\u002F2.forgejo",{"title":231,"path":232,"stem":233},"IT Tools","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fit-tools","en\u002F3.serveex\u002F8.development\u002F3.it-tools",{"title":235,"icon":236,"path":237,"stem":238,"children":239,"page":15},"Useful Apps","i-lucide-award","\u002Fen\u002Fserveex\u002Fapps","en\u002F3.serveex\u002F9.apps",[240,244],{"title":241,"path":242,"stem":243},"Adguard Home","\u002Fen\u002Fserveex\u002Fapps\u002Fadguard","en\u002F3.serveex\u002F9.apps\u002F1.adguard",{"title":245,"path":246,"stem":247},"Vaultwarden","\u002Fen\u002Fserveex\u002Fapps\u002Fvaultwarden","en\u002F3.serveex\u002F9.apps\u002F2.vaultwarden",{"title":249,"icon":250,"path":251,"stem":252,"children":253,"page":15},"Advanced","i-lucide-flask-conical","\u002Fen\u002Fserveex\u002Fadvanced","en\u002F3.serveex\u002F91.advanced",[254,258],{"title":255,"path":256,"stem":257},"Authentik","\u002Fen\u002Fserveex\u002Fadvanced\u002Fauthentik","en\u002F3.serveex\u002F91.advanced\u002F1.authentik",{"title":259,"path":260,"stem":261},"Arcane","\u002Fen\u002Fserveex\u002Fadvanced\u002Farcane","en\u002F3.serveex\u002F91.advanced\u002F2.arcane",{"title":263,"icon":264,"path":265,"stem":266,"children":267,"page":15},"Stockeex","i-noto-computer-disk","\u002Fen\u002Fstockeex","en\u002F4.stockeex",[268],{"title":101,"path":269,"stem":270,"icon":25},"\u002Fen\u002Fstockeex\u002Fintroduction","en\u002F4.stockeex\u002F1.introduction",{"title":272,"icon":273,"path":274,"stem":275,"children":276,"page":15},"My nonsense","i-noto-test-tube","\u002Fen\u002Fnonsense","en\u002F5.nonsense",[277,280,302],{"title":272,"path":278,"stem":279,"icon":25},"\u002Fen\u002Fnonsense\u002Fsummary","en\u002F5.nonsense\u002F1.summary",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":15},"Python","i-lucide-file-code-2","\u002Fen\u002Fnonsense\u002Fpython","en\u002F5.nonsense\u002F2.python",[286,290,294,298],{"title":287,"path":288,"stem":289},"Nvidia Stock Bot","\u002Fen\u002Fnonsense\u002Fpython\u002Fnvidia-stock-bot","en\u002F5.nonsense\u002F2.python\u002F1.nvidia-stock-bot",{"title":291,"path":292,"stem":293},"Adguard CIDRE","\u002Fen\u002Fnonsense\u002Fpython\u002Fadguard-cidre","en\u002F5.nonsense\u002F2.python\u002F2.adguard-cidre",{"title":295,"path":296,"stem":297},"Lumeex","\u002Fen\u002Fnonsense\u002Fpython\u002Flumeex","en\u002F5.nonsense\u002F2.python\u002F3.lumeex",{"title":299,"path":300,"stem":301},"Instameex","\u002Fen\u002Fnonsense\u002Fpython\u002Finstameex","en\u002F5.nonsense\u002F2.python\u002F4.instameex",{"title":303,"icon":304,"path":305,"stem":306,"children":307,"page":15},"Bash","i-lucide-file-terminal","\u002Fen\u002Fnonsense\u002Fbash","en\u002F5.nonsense\u002F3.bash",[308,312,316,320,324,328],{"title":309,"path":310,"stem":311},"Servarr corrector","\u002Fen\u002Fnonsense\u002Fbash\u002Fservarr-duplicates","en\u002F5.nonsense\u002F3.bash\u002F1.servarr-duplicates",{"title":313,"path":314,"stem":315},"LUKS Backup","\u002Fen\u002Fnonsense\u002Fbash\u002Fluks-backup","en\u002F5.nonsense\u002F3.bash\u002F2.luks-backup",{"title":317,"path":318,"stem":319},"Socat Proxy","\u002Fen\u002Fnonsense\u002Fbash\u002Fsocat-proxy","en\u002F5.nonsense\u002F3.bash\u002F3.socat-proxy",{"title":321,"path":322,"stem":323},"HotDisk","\u002Fen\u002Fnonsense\u002Fbash\u002Fhotdisk","en\u002F5.nonsense\u002F3.bash\u002F4.hotdisk",{"title":325,"path":326,"stem":327},"Backrest Docker Stop","\u002Fen\u002Fnonsense\u002Fbash\u002Fbackrest-docker-stop","en\u002F5.nonsense\u002F3.bash\u002F5.backrest-docker-stop",{"title":329,"path":330,"stem":331},"rm Confirmation Guard","\u002Fen\u002Fnonsense\u002Fbash\u002Frm-confirmation","en\u002F5.nonsense\u002F3.bash\u002F6.rm-confirmation",{"title":333,"icon":334,"path":335,"stem":336,"children":337,"page":15},"Recycled","i-noto-recycling-symbol","\u002Fen\u002Frecycled","en\u002F6.recycled",[338,341,355],{"title":333,"path":339,"stem":340,"icon":25},"\u002Fen\u002Frecycled\u002Fsummary","en\u002F6.recycled\u002F1.summary",{"title":342,"icon":343,"path":344,"stem":345,"children":346,"page":15},"Deprecated","i-lucide-trash-2","\u002Fen\u002Frecycled\u002Fdeprecated","en\u002F6.recycled\u002F2.deprecated",[347,351],{"title":348,"path":349,"stem":350},"Wireguard 14","\u002Fen\u002Frecycled\u002Fdeprecated\u002Fwireguard-14","en\u002F6.recycled\u002F2.deprecated\u002F1.wireguard-14",{"title":352,"path":353,"stem":354},"File Browser","\u002Fen\u002Frecycled\u002Fdeprecated\u002Ffile-browser","en\u002F6.recycled\u002F2.deprecated\u002F2.file-browser",{"title":356,"icon":357,"path":358,"stem":359,"children":360,"page":15},"Alternatives","i-lucide-arrow-left-right","\u002Fen\u002Frecycled\u002Falternatives","en\u002F6.recycled\u002F3.alternatives",[361,365,369,373],{"title":362,"path":363,"stem":364},"Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fplex","en\u002F6.recycled\u002F3.alternatives\u002F1.plex",{"title":366,"path":367,"stem":368},"Qbittorrent for Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fqbittorrent-for-plex","en\u002F6.recycled\u002F3.alternatives\u002F2.qbittorrent for plex",{"title":370,"path":371,"stem":372},"Servarr for Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fservarr-for-plex","en\u002F6.recycled\u002F3.alternatives\u002F3.servarr for plex",{"title":374,"path":375,"stem":376},"Gitea","\u002Fen\u002Frecycled\u002Falternatives\u002Fgitea","en\u002F6.recycled\u002F3.alternatives\u002F4.gitea",{"id":378,"title":313,"body":379,"contributors":1263,"description":1265,"extension":1266,"hideCopyPage":15,"hideHeader":15,"hideToc":15,"links":1267,"meta":1268,"navigation":453,"path":314,"seo":1269,"stem":315,"__hash__":1270},"docs_en\u002Fen\u002F5.nonsense\u002F3.bash\u002F2.luks-backup.md",{"type":380,"value":381,"toc":1261},"minimark",[382,390,394,397,400,429,1243,1257],[383,384],"ellipsis",{"blur":385,"left":386,"top":387,"width":388,"z-index":389},"140px","0px","10rem","40rem","60",[391,392,393],"p",{},"I recently realized that having just the password is not enough to unlock a LUKS volume after a failure or corruption. I learned how to dump the LUKS headers from disks\u002Fvolumes and to use the serial numbers along with partition names to accurately identify which header corresponds to which disk\u002Fpartition (I have 10 of them!).",[391,395,396],{},"After struggling to do this manually, I asked Qwen3 (an LLM running on my RTX 5090) to create a script that automates the listing and identification of disks, dumps the headers, and stores them in an encrypted archive ready to be backed up on my backup server.",[391,398,399],{},"This script:",[401,402,403,407,410,417,420,423,426],"ul",{},[404,405,406],"li",{},"Lists and identifies disks with their serial numbers",[404,408,409],{},"Lists partitions",[404,411,412,413],{},"Dumps headers into a secured folder under ",[414,415,416],"code",{},"\u002Froot",[404,418,419],{},"Creates a temporary archive",[404,421,422],{},"Prompts for a password",[404,424,425],{},"Encrypts the archive with that password",[404,427,428],{},"Deletes the unencrypted archive",[430,431,437],"pre",{"className":432,"code":433,"filename":434,"language":435,"meta":436,"style":436},"language-bash shiki shiki-themes github-dark material-theme github-dark","#!\u002Fbin\u002Fbash\n\n# Directory where LUKS headers will be backed up\nDEST=\"\u002Froot\u002Fluks-headers-backup\"\nmkdir -p \"$DEST\"\n\necho \"🔍 Searching for LUKS containers on all partitions...\"\n\n# Loop through all possible disk partitions (including NVMe and SATA)\nfor part in \u002Fdev\u002Fsd? \u002Fdev\u002Fsd?? \u002Fdev\u002Fnvme?n?p?; do\n    # Skip if the device doesn't exist\n    if [ ! -b \"$part\" ]; then\n        continue\n    fi\n\n    # Check if the partition is a LUKS encrypted volume\n    if cryptsetup isLuks \"$part\"; then\n        # Find the parent disk device (e.g. nvme0n1p4 → nvme0n1)\n        disk=$(lsblk -no pkname \"$part\" | head -n 1)\n        full_disk=\"\u002Fdev\u002F$disk\"\n\n        # Get the serial number of the parent disk\n        SERIAL=$(udevadm info --query=all --name=\"$full_disk\" | grep ID_SERIAL= | cut -d= -f2)\n        if [ -z \"$SERIAL\" ]; then\n            SERIAL=\"unknown\"\n        fi\n\n        # Extract the partition name (e.g. nvme0n1p4)\n        PART_NAME=$(basename \"$part\")\n\n        # Build the output filename with partition name and disk serial\n        OUTPUT=\"$DEST\u002Fluks-header-${PART_NAME}__${SERIAL}.img\"\n\n        echo \"🔐 Backing up LUKS header of $part (Serial: $SERIAL)...\"\n\n        # Backup the LUKS header to the output file\n        cryptsetup luksHeaderBackup \"$part\" --header-backup-file \"$OUTPUT\"\n        if [[ $? -eq 0 ]]; then\n            echo \"✅ Backup successful → $OUTPUT\"\n        else\n            echo \"❌ Backup failed for $part\"\n        fi\n    fi\ndone\n\n# Create a timestamped compressed tar archive of all header backups\nARCHIVE_NAME=\"\u002Froot\u002Fluks-headers-$(date +%Y%m%d_%H%M%S).tar.gz\"\necho \"📦 Creating archive $ARCHIVE_NAME...\"\ntar -czf \"$ARCHIVE_NAME\" -C \"$DEST\" .\n\n# Encrypt the archive symmetrically using GPG with AES256 cipher\necho \"🔐 Encrypting the archive with GPG...\"\ngpg --symmetric --cipher-algo AES256 \"$ARCHIVE_NAME\"\nif [[ $? -eq 0 ]]; then\n    echo \"✅ Encrypted archive created: ${ARCHIVE_NAME}.gpg\"\n    # Remove the unencrypted archive for security\n    rm -f \"$ARCHIVE_NAME\"\nelse\n    echo \"❌ Encryption failed\"\nfi\n","Terminal","bash","",[414,438,439,448,455,461,483,502,507,521,526,532,561,567,595,601,607,612,618,639,645,687,705,710,716,766,788,803,809,814,820,841,846,852,891,896,919,924,930,955,978,993,999,1013,1018,1023,1029,1034,1040,1069,1087,1114,1119,1125,1137,1158,1176,1198,1204,1219,1225,1237],{"__ignoreMap":436},[440,441,444],"span",{"class":442,"line":443},"line",1,[440,445,447],{"class":446},"sDvJj","#!\u002Fbin\u002Fbash\n",[440,449,451],{"class":442,"line":450},2,[440,452,454],{"emptyLinePlaceholder":453},true,"\n",[440,456,458],{"class":442,"line":457},3,[440,459,460],{"class":446},"# Directory where LUKS headers will be backed up\n",[440,462,464,468,472,476,480],{"class":442,"line":463},4,[440,465,467],{"class":466},"slcoZ","DEST",[440,469,471],{"class":470},"sJPTy","=",[440,473,475],{"class":474},"s8K8j","\"",[440,477,479],{"class":478},"s11XM","\u002Froot\u002Fluks-headers-backup",[440,481,482],{"class":474},"\"\n",[440,484,486,490,494,497,500],{"class":442,"line":485},5,[440,487,489],{"class":488},"sEgDM","mkdir",[440,491,493],{"class":492},"sJWha"," -p",[440,495,496],{"class":474}," \"",[440,498,499],{"class":466},"$DEST",[440,501,482],{"class":474},[440,503,505],{"class":442,"line":504},6,[440,506,454],{"emptyLinePlaceholder":453},[440,508,510,514,516,519],{"class":442,"line":509},7,[440,511,513],{"class":512},"sJGgK","echo",[440,515,496],{"class":474},[440,517,518],{"class":478},"🔍 Searching for LUKS containers on all partitions...",[440,520,482],{"class":474},[440,522,524],{"class":442,"line":523},8,[440,525,454],{"emptyLinePlaceholder":453},[440,527,529],{"class":442,"line":528},9,[440,530,531],{"class":446},"# Loop through all possible disk partitions (including NVMe and SATA)\n",[440,533,535,539,542,545,548,551,554,558],{"class":442,"line":534},10,[440,536,538],{"class":537},"sJLGa","for",[440,540,541],{"class":466}," part ",[440,543,544],{"class":537},"in",[440,546,547],{"class":478}," \u002Fdev\u002Fsd?",[440,549,550],{"class":478}," \u002Fdev\u002Fsd??",[440,552,553],{"class":478}," \u002Fdev\u002Fnvme?n?p?",[440,555,557],{"class":556},"s8jd1",";",[440,559,560],{"class":537}," do\n",[440,562,564],{"class":442,"line":563},11,[440,565,566],{"class":446},"    # Skip if the device doesn't exist\n",[440,568,570,573,576,579,582,584,587,589,592],{"class":442,"line":569},12,[440,571,572],{"class":537},"    if",[440,574,575],{"class":556}," [",[440,577,578],{"class":470}," !",[440,580,581],{"class":470}," -b",[440,583,496],{"class":474},[440,585,586],{"class":466},"$part",[440,588,475],{"class":474},[440,590,591],{"class":556}," ];",[440,593,594],{"class":537}," then\n",[440,596,598],{"class":442,"line":597},13,[440,599,600],{"class":537},"        continue\n",[440,602,604],{"class":442,"line":603},14,[440,605,606],{"class":537},"    fi\n",[440,608,610],{"class":442,"line":609},15,[440,611,454],{"emptyLinePlaceholder":453},[440,613,615],{"class":442,"line":614},16,[440,616,617],{"class":446},"    # Check if the partition is a LUKS encrypted volume\n",[440,619,621,623,626,629,631,633,635,637],{"class":442,"line":620},17,[440,622,572],{"class":537},[440,624,625],{"class":488}," cryptsetup",[440,627,628],{"class":478}," isLuks",[440,630,496],{"class":474},[440,632,586],{"class":466},[440,634,475],{"class":474},[440,636,557],{"class":556},[440,638,594],{"class":537},[440,640,642],{"class":442,"line":641},18,[440,643,644],{"class":446},"        # Find the parent disk device (e.g. nvme0n1p4 → nvme0n1)\n",[440,646,648,651,653,656,659,662,665,667,669,671,674,677,680,684],{"class":442,"line":647},19,[440,649,650],{"class":466},"        disk",[440,652,471],{"class":470},[440,654,655],{"class":556},"$(",[440,657,658],{"class":488},"lsblk",[440,660,661],{"class":492}," -no",[440,663,664],{"class":478}," pkname",[440,666,496],{"class":474},[440,668,586],{"class":466},[440,670,475],{"class":474},[440,672,673],{"class":470}," |",[440,675,676],{"class":488}," head",[440,678,679],{"class":492}," -n",[440,681,683],{"class":682},"swwWl"," 1",[440,685,686],{"class":556},")\n",[440,688,690,693,695,697,700,703],{"class":442,"line":689},20,[440,691,692],{"class":466},"        full_disk",[440,694,471],{"class":470},[440,696,475],{"class":474},[440,698,699],{"class":478},"\u002Fdev\u002F",[440,701,702],{"class":466},"$disk",[440,704,482],{"class":474},[440,706,708],{"class":442,"line":707},21,[440,709,454],{"emptyLinePlaceholder":453},[440,711,713],{"class":442,"line":712},22,[440,714,715],{"class":446},"        # Get the serial number of the parent disk\n",[440,717,719,722,724,726,729,732,735,738,740,743,745,747,750,753,755,758,761,764],{"class":442,"line":718},23,[440,720,721],{"class":466},"        SERIAL",[440,723,471],{"class":470},[440,725,655],{"class":556},[440,727,728],{"class":488},"udevadm",[440,730,731],{"class":478}," info",[440,733,734],{"class":492}," --query=all",[440,736,737],{"class":492}," --name=",[440,739,475],{"class":474},[440,741,742],{"class":466},"$full_disk",[440,744,475],{"class":474},[440,746,673],{"class":470},[440,748,749],{"class":488}," grep",[440,751,752],{"class":478}," ID_SERIAL=",[440,754,673],{"class":470},[440,756,757],{"class":488}," cut",[440,759,760],{"class":492}," -d=",[440,762,763],{"class":492}," -f2",[440,765,686],{"class":556},[440,767,769,772,774,777,779,782,784,786],{"class":442,"line":768},24,[440,770,771],{"class":537},"        if",[440,773,575],{"class":556},[440,775,776],{"class":470}," -z",[440,778,496],{"class":474},[440,780,781],{"class":466},"$SERIAL",[440,783,475],{"class":474},[440,785,591],{"class":556},[440,787,594],{"class":537},[440,789,791,794,796,798,801],{"class":442,"line":790},25,[440,792,793],{"class":466},"            SERIAL",[440,795,471],{"class":470},[440,797,475],{"class":474},[440,799,800],{"class":478},"unknown",[440,802,482],{"class":474},[440,804,806],{"class":442,"line":805},26,[440,807,808],{"class":537},"        fi\n",[440,810,812],{"class":442,"line":811},27,[440,813,454],{"emptyLinePlaceholder":453},[440,815,817],{"class":442,"line":816},28,[440,818,819],{"class":446},"        # Extract the partition name (e.g. nvme0n1p4)\n",[440,821,823,826,828,830,833,835,837,839],{"class":442,"line":822},29,[440,824,825],{"class":466},"        PART_NAME",[440,827,471],{"class":470},[440,829,655],{"class":556},[440,831,832],{"class":488},"basename",[440,834,496],{"class":474},[440,836,586],{"class":466},[440,838,475],{"class":474},[440,840,686],{"class":556},[440,842,844],{"class":442,"line":843},30,[440,845,454],{"emptyLinePlaceholder":453},[440,847,849],{"class":442,"line":848},31,[440,850,851],{"class":446},"        # Build the output filename with partition name and disk serial\n",[440,853,855,858,860,862,864,867,870,873,876,879,881,884,886,889],{"class":442,"line":854},32,[440,856,857],{"class":466},"        OUTPUT",[440,859,471],{"class":470},[440,861,475],{"class":474},[440,863,499],{"class":466},[440,865,866],{"class":478},"\u002Fluks-header-",[440,868,869],{"class":474},"${",[440,871,872],{"class":466},"PART_NAME",[440,874,875],{"class":474},"}",[440,877,878],{"class":478},"__",[440,880,869],{"class":474},[440,882,883],{"class":466},"SERIAL",[440,885,875],{"class":474},[440,887,888],{"class":478},".img",[440,890,482],{"class":474},[440,892,894],{"class":442,"line":893},33,[440,895,454],{"emptyLinePlaceholder":453},[440,897,899,902,904,907,909,912,914,917],{"class":442,"line":898},34,[440,900,901],{"class":512},"        echo",[440,903,496],{"class":474},[440,905,906],{"class":478},"🔐 Backing up LUKS header of ",[440,908,586],{"class":466},[440,910,911],{"class":478}," (Serial: ",[440,913,781],{"class":466},[440,915,916],{"class":478},")...",[440,918,482],{"class":474},[440,920,922],{"class":442,"line":921},35,[440,923,454],{"emptyLinePlaceholder":453},[440,925,927],{"class":442,"line":926},36,[440,928,929],{"class":446},"        # Backup the LUKS header to the output file\n",[440,931,933,936,939,941,943,945,948,950,953],{"class":442,"line":932},37,[440,934,935],{"class":488},"        cryptsetup",[440,937,938],{"class":478}," luksHeaderBackup",[440,940,496],{"class":474},[440,942,586],{"class":466},[440,944,475],{"class":474},[440,946,947],{"class":492}," --header-backup-file",[440,949,496],{"class":474},[440,951,952],{"class":466},"$OUTPUT",[440,954,482],{"class":474},[440,956,958,960,963,967,970,973,976],{"class":442,"line":957},38,[440,959,771],{"class":537},[440,961,962],{"class":556}," [[",[440,964,966],{"class":965},"s8-mJ"," $?",[440,968,969],{"class":470}," -eq",[440,971,972],{"class":682}," 0",[440,974,975],{"class":556}," ]];",[440,977,594],{"class":537},[440,979,981,984,986,989,991],{"class":442,"line":980},39,[440,982,983],{"class":512},"            echo",[440,985,496],{"class":474},[440,987,988],{"class":478},"✅ Backup successful → ",[440,990,952],{"class":466},[440,992,482],{"class":474},[440,994,996],{"class":442,"line":995},40,[440,997,998],{"class":537},"        else\n",[440,1000,1002,1004,1006,1009,1011],{"class":442,"line":1001},41,[440,1003,983],{"class":512},[440,1005,496],{"class":474},[440,1007,1008],{"class":478},"❌ Backup failed for ",[440,1010,586],{"class":466},[440,1012,482],{"class":474},[440,1014,1016],{"class":442,"line":1015},42,[440,1017,808],{"class":537},[440,1019,1021],{"class":442,"line":1020},43,[440,1022,606],{"class":537},[440,1024,1026],{"class":442,"line":1025},44,[440,1027,1028],{"class":537},"done\n",[440,1030,1032],{"class":442,"line":1031},45,[440,1033,454],{"emptyLinePlaceholder":453},[440,1035,1037],{"class":442,"line":1036},46,[440,1038,1039],{"class":446},"# Create a timestamped compressed tar archive of all header backups\n",[440,1041,1043,1046,1048,1050,1053,1055,1058,1061,1064,1067],{"class":442,"line":1042},47,[440,1044,1045],{"class":466},"ARCHIVE_NAME",[440,1047,471],{"class":470},[440,1049,475],{"class":474},[440,1051,1052],{"class":478},"\u002Froot\u002Fluks-headers-",[440,1054,655],{"class":474},[440,1056,1057],{"class":488},"date",[440,1059,1060],{"class":478}," +%Y%m%d_%H%M%S",[440,1062,1063],{"class":474},")",[440,1065,1066],{"class":478},".tar.gz",[440,1068,482],{"class":474},[440,1070,1072,1074,1076,1079,1082,1085],{"class":442,"line":1071},48,[440,1073,513],{"class":512},[440,1075,496],{"class":474},[440,1077,1078],{"class":478},"📦 Creating archive ",[440,1080,1081],{"class":466},"$ARCHIVE_NAME",[440,1083,1084],{"class":478},"...",[440,1086,482],{"class":474},[440,1088,1090,1093,1096,1098,1100,1102,1105,1107,1109,1111],{"class":442,"line":1089},49,[440,1091,1092],{"class":488},"tar",[440,1094,1095],{"class":492}," -czf",[440,1097,496],{"class":474},[440,1099,1081],{"class":466},[440,1101,475],{"class":474},[440,1103,1104],{"class":492}," -C",[440,1106,496],{"class":474},[440,1108,499],{"class":466},[440,1110,475],{"class":474},[440,1112,1113],{"class":478}," .\n",[440,1115,1117],{"class":442,"line":1116},50,[440,1118,454],{"emptyLinePlaceholder":453},[440,1120,1122],{"class":442,"line":1121},51,[440,1123,1124],{"class":446},"# Encrypt the archive symmetrically using GPG with AES256 cipher\n",[440,1126,1128,1130,1132,1135],{"class":442,"line":1127},52,[440,1129,513],{"class":512},[440,1131,496],{"class":474},[440,1133,1134],{"class":478},"🔐 Encrypting the archive with GPG...",[440,1136,482],{"class":474},[440,1138,1140,1143,1146,1149,1152,1154,1156],{"class":442,"line":1139},53,[440,1141,1142],{"class":488},"gpg",[440,1144,1145],{"class":492}," --symmetric",[440,1147,1148],{"class":492}," --cipher-algo",[440,1150,1151],{"class":478}," AES256",[440,1153,496],{"class":474},[440,1155,1081],{"class":466},[440,1157,482],{"class":474},[440,1159,1161,1164,1166,1168,1170,1172,1174],{"class":442,"line":1160},54,[440,1162,1163],{"class":537},"if",[440,1165,962],{"class":556},[440,1167,966],{"class":965},[440,1169,969],{"class":470},[440,1171,972],{"class":682},[440,1173,975],{"class":556},[440,1175,594],{"class":537},[440,1177,1179,1182,1184,1187,1189,1191,1193,1196],{"class":442,"line":1178},55,[440,1180,1181],{"class":512},"    echo",[440,1183,496],{"class":474},[440,1185,1186],{"class":478},"✅ Encrypted archive created: ",[440,1188,869],{"class":474},[440,1190,1045],{"class":466},[440,1192,875],{"class":474},[440,1194,1195],{"class":478},".gpg",[440,1197,482],{"class":474},[440,1199,1201],{"class":442,"line":1200},56,[440,1202,1203],{"class":446},"    # Remove the unencrypted archive for security\n",[440,1205,1207,1210,1213,1215,1217],{"class":442,"line":1206},57,[440,1208,1209],{"class":488},"    rm",[440,1211,1212],{"class":492}," -f",[440,1214,496],{"class":474},[440,1216,1081],{"class":466},[440,1218,482],{"class":474},[440,1220,1222],{"class":442,"line":1221},58,[440,1223,1224],{"class":537},"else\n",[440,1226,1228,1230,1232,1235],{"class":442,"line":1227},59,[440,1229,1181],{"class":512},[440,1231,496],{"class":474},[440,1233,1234],{"class":478},"❌ Encryption failed",[440,1236,482],{"class":474},[440,1238,1240],{"class":442,"line":1239},60,[440,1241,1242],{"class":537},"fi\n",[391,1244,1245],{},[1246,1247,1248,1249,1252,1253,1256],"strong",{},"Don’t forget to back up ",[414,1250,1251],{},"\u002Fetc\u002Ffstab"," and ",[414,1254,1255],{},"\u002Fetc\u002Fcrypttab"," as well!",[1258,1259,1260],"style",{},"html pre.shiki code .sDvJj, html code.shiki .sDvJj{--shiki-light:#6A737D;--shiki-light-font-style:inherit;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .slcoZ, html code.shiki .slcoZ{--shiki-light:#E1E4E8;--shiki-default:#EEFFFF;--shiki-dark:#E1E4E8}html pre.shiki code .sJPTy, html code.shiki .sJPTy{--shiki-light:#F97583;--shiki-default:#89DDFF;--shiki-dark:#F97583}html pre.shiki code .s8K8j, html code.shiki .s8K8j{--shiki-light:#9ECBFF;--shiki-default:#89DDFF;--shiki-dark:#9ECBFF}html pre.shiki code .s11XM, html code.shiki .s11XM{--shiki-light:#9ECBFF;--shiki-default:#C3E88D;--shiki-dark:#9ECBFF}html pre.shiki code .sEgDM, html code.shiki .sEgDM{--shiki-light:#B392F0;--shiki-default:#FFCB6B;--shiki-dark:#B392F0}html pre.shiki code .sJWha, html code.shiki .sJWha{--shiki-light:#79B8FF;--shiki-default:#C3E88D;--shiki-dark:#79B8FF}html pre.shiki code .sJGgK, html code.shiki .sJGgK{--shiki-light:#79B8FF;--shiki-default:#82AAFF;--shiki-dark:#79B8FF}html pre.shiki code .sJLGa, html code.shiki .sJLGa{--shiki-light:#F97583;--shiki-light-font-style:inherit;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .s8jd1, html code.shiki .s8jd1{--shiki-light:#E1E4E8;--shiki-default:#89DDFF;--shiki-dark:#E1E4E8}html pre.shiki code .swwWl, html code.shiki .swwWl{--shiki-light:#79B8FF;--shiki-default:#F78C6C;--shiki-dark:#79B8FF}html pre.shiki code .s8-mJ, html code.shiki .s8-mJ{--shiki-light:#79B8FF;--shiki-default:#EEFFFF;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":436,"searchDepth":450,"depth":450,"links":1262},[],[1264],"Djeex","A bash script to automatically dump LUKS headers from all encrypted disks, identify them by serial number, and store them in an encrypted archive.","md",null,{},{"title":313,"description":1265},"ss75CjrGtogB4aPhtKSNMESF1eBJWiVCvYRv32nR9Tc",[1272,1274],{"title":309,"path":310,"stem":311,"description":1273,"children":-1},"A bash script to detect and fix duplicate media files in Sonarr and Radarr libraries by replacing copies with hardlinks to reclaim disk space.",{"title":317,"path":318,"stem":319,"description":1275,"children":-1},"Use socat to proxy the Docker socket through Docker Socket Proxy, allowing Beszel to collect container stats without exposing the full Docker socket.",1788645859315]