Ubuntu 22.04桌面版安装时RAID 6阵列加密配置疑问
Ubuntu 22.04桌面版安装时RAID 6阵列加密配置疑问
Hey there! Let me walk you through exactly when and how to encrypt your RAID 6 array during a fresh Ubuntu 22.04 Desktop installation—since the default installer doesn’t make this super obvious, we’ll need to take a quick detour into the live environment first:
Step-by-Step Breakdown
- Start by choosing "Try Ubuntu" instead of "Install Ubuntu" when you boot from the installation media. The desktop installer’s built-in tools don’t support creating encrypted RAID directly, so we’ll set up the RAID and encryption manually first.
- Open a terminal (press
Ctrl+Alt+T), then install the required tools with this command:sudo apt update && sudo apt install mdadm cryptsetup - Run
lsblkto list all your drives and confirm the device names for the disks you want to use in the RAID 6 (e.g.,/dev/sdb,/dev/sdc,/dev/sdd—double-check you don’t pick your SSDs for root/boot!). - Create the RAID 6 array. Replace
Xwith the number of disks you’re using (minimum 3) and the/dev/sd*entries with your actual disk names:sudo mdadm --create /dev/md0 --level=6 --raid-devices=X /dev/sdb /dev/sdc /dev/sdd - Now encrypt the RAID array. You’ll be prompted to set a strong password—don’t lose this, as it’s the only way to recover your data later:
sudo cryptsetup luksFormat /dev/md0 - Unlock the encrypted RAID device (we’ll use
encrypted_raidas an alias here, but you can name it anything):sudo cryptsetup luksOpen /dev/md0 encrypted_raid - Format the unlocked encrypted device with a filesystem like ext4:
sudo mkfs.ext4 /dev/mapper/encrypted_raid - Launch the Ubuntu installer from the live desktop. When you get to the partitioning step, select "Something else" (manual partitioning).
- Set up your two SSDs for
/bootand/(root) as you planned. Then locate/dev/mapper/encrypted_raidand assign it a mount point (like/data, or whatever makes sense for your use case). - Finish the installation as normal. The installer will automatically add the necessary entries to
/etc/fstaband/etc/crypttab, so after rebooting you’ll just need to enter your encryption password to unlock the RAID 6 array.
Quick Notes
- Double-check your disk names before running any commands—you don’t want to accidentally wipe your SSDs!
- Store your encryption password somewhere safe. If you lose it, there’s no way to retrieve the data on the RAID array.
- If you want automatic unlocking (not recommended for desktop setups, since it reduces security), you can set up a key file, but manual password entry is the safer default.
备注:内容来源于stack exchange,提问作者hank744
相关产品推荐
相关产品推荐

