encrypted BTRFS multi-disk system
To set up an encrypted BTRFS multi-disk system in Alpine Linux, follow these steps:
Preparation
- Install necessary packages:
apk add btrfs-progs cryptsetup blkid
Encryption Setup
- Encrypt each disk partition you want to use:
cryptsetup luksFormat /dev/nvme0n1p2 cryptsetup luksFormat /dev/nvme0n1p3
- Open the encrypted partitions:
cryptsetup open /dev/nvme0n1p2 crypt1 cryptsetup open /dev/nvme0n1p3 crypt2
BTRFS Configuration
- Create a BTRFS filesystem across the encrypted partitions:
mkfs.btrfs -m raid1 -d raid1 /dev/mapper/crypt1 /dev/mapper/crypt2
- Mount the BTRFS filesystem:
mount /dev/mapper/crypt1 /mnt
- Create subvolumes:
btrfs subvolume create /mnt/root btrfs subvolume create /mnt/home
- Unmount the filesystem:
umount /mnt
- Mount the root subvolume:
mount -o subvol=root /dev/mapper/crypt1 /mnt
System Configuration
Edit
/etc/crypttab
to include both encrypted partitionsModify
/etc/fstab
to mount the BTRFS subvolumesUpdate
/etc/mkinitfs/mkinitfs.conf
to include necessary features:
features="ata base cdrom btrfs keymap kms mmc nvme raid scsi usb cryptsetup cryptkey resume"
- Create a kernel hook to ensure proper boot setup
- ۰ نظر
- ۲۳ مهر ۰۳ ، ۱۰:۰۹