روزنوشته های یک برنامه نویس

۲ مطلب در مهر ۱۴۰۳ ثبت شده است

ZFS on alpine linux

دوشنبه, ۲۳ مهر ۱۴۰۳، ۰۲:۴۲ ب.ظ

# install packages

apk add zfs zfs-lts

# load kernel modules
modprobe zfs
modprobe spl

# enable kernel module
echo zfs >> /etc/modules

# activate services
rc-update add zfs-import boot
rc-update add zfs-mount boot
rc-update add zfs-share boot

zpool status

# create pool with first disk
zpool create zpool /dev/sdb

# add other disks
zpool add zpool /dev/sdc

zpool status

zfs set compression=lz4 zpool

# mount if not mounted
zfs mount zpool

ll /zpool/
zpool list

# expand a disk to avail size
zpool online -e zpool /dev/sdc

 

  • epi log

encrypted BTRFS multi-disk system

دوشنبه, ۲۳ مهر ۱۴۰۳، ۱۰:۰۹ ق.ظ

To set up an encrypted BTRFS multi-disk system in Alpine Linux, follow these steps:

Preparation

  1. Install necessary packages:

apk add btrfs-progs cryptsetup blkid

Encryption Setup

  1. Encrypt each disk partition you want to use:

cryptsetup luksFormat /dev/nvme0n1p2 cryptsetup luksFormat /dev/nvme0n1p3

  1. Open the encrypted partitions:

cryptsetup open /dev/nvme0n1p2 crypt1 cryptsetup open /dev/nvme0n1p3 crypt2

BTRFS Configuration

  1. Create a BTRFS filesystem across the encrypted partitions:

mkfs.btrfs -m raid1 -d raid1 /dev/mapper/crypt1 /dev/mapper/crypt2

  1. Mount the BTRFS filesystem:

mount /dev/mapper/crypt1 /mnt

  1. Create subvolumes:

btrfs subvolume create /mnt/root btrfs subvolume create /mnt/home

  1. Unmount the filesystem:

umount /mnt

  1. Mount the root subvolume:

mount -o subvol=root /dev/mapper/crypt1 /mnt

System Configuration

  1. Edit /etc/crypttab to include both encrypted partitions

  2. Modify /etc/fstab to mount the BTRFS subvolumes

  3. Update /etc/mkinitfs/mkinitfs.conf to include necessary features:

features="ata base cdrom btrfs keymap kms mmc nvme raid scsi usb cryptsetup cryptkey resume"

  1. Create a kernel hook to ensure proper boot setup
  • epi log