Skip to content

Instantly share code, notes, and snippets.

View gharib-uk's full-sized avatar
✌️
LIBERTY

Alireza Gharib gharib-uk

✌️
LIBERTY
View GitHub Profile
@gharib-uk
gharib-uk / Xen.md
Created November 15, 2025 12:46
Installing xen hypervisor on Debian 12

What is the Xen Hypervisor

Xen is a powerful, open-source Type 1 (or "bare-metal") hypervisor. This means it runs directly on your computer's hardware, acting as a foundation before any operating system loads.

It has a unique architecture that separates it from other hypervisors like KVM or VirtualBox (which is a Type 2 hypervisor that runs inside an existing OS).

Key Concepts

  • Hypervisor: The core Xen software. It's a minimal "microkernel" that schedules and isolates a computer's physical resources (CPU, memory) between different virtual machines.
  • Dom0 (Control Domain): This is the most important concept. Dom0 is a special, privileged virtual machine that runs first. It's typically a modified Linux that has special drivers to talk to the Xen hypervisor. You use Dom0 to:
@gharib-uk
gharib-uk / linux-hardening.md
Last active November 11, 2025 13:59
Gnu-Linux Hardening Tips

Gnu-Linux Hardening

Here is a list of common and important security parameters, categorized by how they are set.

  1. Boot-time parameters: These are passed to the kernel by the bootloader (like GRUB) when the system first starts. You mentioned kaslr, which is a perfect example.
  2. Runtime parameters (sysctl): These can be viewed and changed on a running system using the sysctl command or by modifying files in /proc/sys/.

Boot-Time (Kernel Command Line) Parameters

@gharib-uk
gharib-uk / kvm_arch.md
Created November 8, 2025 16:30
KVM on Arch Linux

QEMU-KVM in Arch Linux

Check Virtualization Support

lscpu | grep -i Virtualization
  • VT-x for Intel
  • AMD-Vi for AMD

Ensure that your kernel includes KVM modules

@gharib-uk
gharib-uk / btrfs.md
Created October 28, 2025 07:33
Introduction to B-Tree FileSystem (BTRFS)

What is BTRFS?

BTRFS (B-tree File System) is a modern, high-performance Copy-on-Write (CoW) filesystem built directly into the Linux kernel. It's designed to be a flexible, reliable, and easy-to-use replacement for older filesystems like ext4. Its development is in-kernel (GPL-licensed), ensuring seamless integration with Linux.


Core Features

  • Copy-on-Write (CoW): When you modify a file, BTRFS writes the changes to a new location on the disk instead of overwriting the old data. This makes operations like snapshots instant and ensures the filesystem is always in a consistent state (no need for a long fsck after a crash).
  • Data Integrity (Checksums): BTRFS calculates a "fingerprint" (checksum) for all data and metadata. When you read a file, it re-checks the fingerprint. If they don't match, BTRFS knows the data is corrupt. This protects you from silent data corruption or "bit rot."
@gharib-uk
gharib-uk / zfs.md
Last active November 11, 2025 13:44
Introduction to ZFS filesystem (OpenZFS)

ZFS

Created with an uncompromising focus on data integrity. ZFS integrates the roles of a filesystem and a volume manager. This gives it a complete view of the storage layout, from the physical disks to the files, enabling features like end-to-end checksumming and self-healing.

COW

Also utilizes a CoW transactional model. Every write is a new block, and a group of writes is committed as a transaction. This ensures that the filesystem is always in a consistent state.

@gharib-uk
gharib-uk / bst-traverse.md
Last active October 15, 2025 09:27
Binary Search Tree
FUNCTION IterativeInOrder(rootNode):
    // Create an empty stack to store nodes
    CREATE a stack

    // Start with the root of the tree
    currentNode = rootNode

    // Loop as long as there are nodes to process or the stack is not empty
    WHILE currentNode is not NULL OR stack is not EMPTY:
@gharib-uk
gharib-uk / fs.md
Created October 13, 2025 20:08
Different FS available on GNU linux
title description
Filesystems
Description and recommendations for the available filesystems. (ext4, f2fs, btrfs, xfs, zfs, bcachefs)

GNU Linux offers 5 different filesystems to allow the user to choose what best fits their needs. The following will go over advantages, disadvantages, and recommendations for each filesystem.

XFS

XFS is a journaling filesystem created and developed by Silicon Graphics, Inc. It was created in 1993, ported to linux in 2001, and is now widely supported by most Linux distributions.

@gharib-uk
gharib-uk / lvm.md
Created October 12, 2025 15:58
LVM Comprehensive guide

🧑‍🏫 LVM in Linux – A Comprehensive Guide

1. What is LVM?

LVM (Logical Volume Manager) is a storage management solution in Linux that provides flexibility and scalability compared to using raw partitions. Instead of being tied directly to physical disks and fixed partitions, LVM allows you to:

  • Create logical volumes (LVs) that behave like partitions but can be resized easily.
  • Combine multiple physical disks into a single pool of storage.
  • Take snapshots for backups.
@gharib-uk
gharib-uk / kubeadm-multi-node-cluster.md
Last active September 27, 2025 14:49
Install Multi-Node cluster (One Master, Two Worker) With Kubeadm

ALL NODES

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter
@gharib-uk
gharib-uk / host-to-vm-ssh.md
Created September 17, 2025 11:46
Send file with scp from host to vm

scp name@ip: