Jump to content

User:Kulak

From ArchWiki

Home lab data

The following table is the result of the command:

tar --xattrs --acls -cf - -C /mnt/data1 . | mbuffer -m 1G -P 80 | pv -s 3597517937334 | tar --xattrs --acls -xpf - -C /mnt/data1_new

which basically copied from BTRFS file system on /mnt/data1 to XFS file system on /mnt/data1_new. Notice 1 TB drive utilization difference.

Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/data1vg-data1  7.3T  3.5T  3.9T  47% /mnt/data1_new
/dev/dm-13                 7.3T  3.2T  2.1T  61% /mnt/data1

Somthing to think about in favour of XFS and yet another issue with BTRFS.

XFS was built with

mkfs.xfs -L data1 -l size=128m -i size=512 -f /dev/data1vg/data1

The original BTRFS has no subvolumes or snapshots:

sudo btrfs subvolume list -a /mnt/data1
ID 257 gen 491630 top level 5 path <FS_TREE>/@data
sudo btrfs filesystem usage /mnt/data1
WARNING: failed to get device size for <missing disk>: No such file or directory
Overall:
   Device size:                  14.55TiB
   Device allocated:              6.43TiB
   Device unallocated:            8.12TiB
   Device missing:                7.28TiB
   Device slack:                  3.50KiB
   Used:                          6.38TiB
   Free (estimated):              4.08TiB      (min: 4.08TiB)
   Free (statfs, df):             2.05TiB
   Data ratio:                       2.00
   Metadata ratio:                   2.00
   Global reserve:              512.00MiB      (used: 0.00B)
   Multiple profiles:                  no

Data,RAID1: Size:3.21TiB, Used:3.18TiB (99.35%)
  /dev/dm-13      3.21TiB
  <missing disk>          3.21TiB

Metadata,RAID1: Size:9.00GiB, Used:4.53GiB (50.29%)
  /dev/dm-13      9.00GiB
  <missing disk>          9.00GiB

System,RAID1: Size:32.00MiB, Used:512.00KiB (1.56%)
  /dev/dm-13     32.00MiB
  <missing disk>         32.00MiB

Unallocated:
  /dev/dm-13      4.06TiB
  <missing disk>          4.06TiB

---

Direct Disk Encryption

device=/dev/sdc
cryptsetup luksFormat --type luks2 --align-payload=4096 -s 256 -c aes-xts-plain64 --label cdata1_backup $device
cryptsetup open /dev/by-label/cdata1_backup cdata1_backup
mkfs.btrfs --label data1_backup /dev/mapper/cdata1_backup
mount /dev/disk/by-label/data1_backup /mnt/backup/data1_backup
btrfs subvolume create /mnt/backup/data1_backup/@data1backup
umount /mnt/backup/data1_backup
cryptsetup luksDump /dev/disk/by-label/cdata1_backup
cryptsetup luksAddKey /dev/disk/by-label/cdata1_backup /etc/vault/disk-key
nvim /etc/crypttab
    cdata1_backup  /dev/disk/by-label/cdata1_backup             /etc/vault/disk-key
nvim /etc/fstab
  # /dev/mapper/cdata1_backup UUID=30d29047-09b0-49f5-9d61-d7a6f3033d5e
  LABEL=data1_backup      /               btrfs           rw,relatime,space_cache=v2,subvolid=5,subvol=/  0 0


Other

device=/dev/nvme0n1

partition=/dev/nvme0n1p3  or /dev/disk/by-partlabel/csys0
fdisk -l $device
cryptsetup luksFormat --type luks2 --align-payload=512 -s 256 -c aes-xts-plain64 --label sys0parent $partition
cryptsetup open /dev/disk/by-partlabel/csys0 sys0
mkfs.btrfs --label arch0 /dev/mapper/sys0
mount LABEL=arch0 /mnt

btrfs subvolume create /mnt/@arch
btrfs subvolume create /mnt/@snapshots

umount -R /mnt

mount -o defaults,x-mount.mkdir,compress=zstd,ssd,noatime,subvol=@arch LABEL=arch0 /mnt
mount LABEL=EFI /mnt/boot

arch-chroot /mnt

pacstrap -K /mnt base linux linux-firmware amd-ucode neovim networkmanager linux-firmware-qlogic btrfs-progs

Follow installation guide until `mkinitcpio` section.

create file: `/etc/mkinitcpio.conf.d/arch.conf` with content:

cat /etc/mkinitcpio.conf
MODULES=(btrfs)
BINARIES=(/usr/bin/btrfs)
FILES=()
HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)
mkinitcpio -p linux
cat /boot/loader/entries/arch.
title Arch Linux (encrypted btrfs)
linux /vmlinux-linux
initrd /amd-ucode.img
initrd /intramfs-linux.img
options cryptdevice=PARTLABEL=csystem:system root=/dev/mapper/system rw rootflags=subvol=@root,rw rootfstype=btrfs

Other options: cryptkey=/dev/dsdf1:50500:200 - option does not work cryptkey=PARTLABEL=seckey:auto:/sec.keyf - option does not work rd.log=all

Copy data from filesystem file:

dd skip=50500 bs=200 count=1 if=/dev/sdf1 of=/root/keyslot1

btrfs from single drive to two in raid 1 mode:

btrfs filesystem show /mnt/data
btrfs device add /dev/mapper/data2 /mnt/data
btrfs filesystem show /mnt/data
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/data

References: