-
Notifications
You must be signed in to change notification settings - Fork 21
homelab storage #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homelab storage #138
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,377 @@ | ||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
| marp: true | ||||||||||||||||||||||||||||||||
| theme: default | ||||||||||||||||||||||||||||||||
| class: invert | ||||||||||||||||||||||||||||||||
| footer: Slides written by Connor Sample - https://tabulate.tech | ||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Homelabbing - Storage & Backups | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <!-- footer: "" --> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Recap: What is homelabbing? | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Resources | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - <https://github.com/jmunixusers/presentations/blob/main/homelab.md> | ||||||||||||||||||||||||||||||||
| - <https://github.com/jmunixusers/presentations/blob/main/homelab-2.md> | ||||||||||||||||||||||||||||||||
| - <https://selfh.st> | ||||||||||||||||||||||||||||||||
| - <https://github.com/awesome-selfhosted/awesome-selfhosted> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Storage Issues | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - 3 Problems with Storage: | ||||||||||||||||||||||||||||||||
| - **Capacity** | ||||||||||||||||||||||||||||||||
| - **Redundancy** | ||||||||||||||||||||||||||||||||
| - **Integrity (bit rot)** | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Hardware | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - **CMR (Conventional Magnetic Recording)**: tracks are next to each other (this is what you need to use) | ||||||||||||||||||||||||||||||||
| - **SMR (Shingled Magnetic Recording)**: tracks are "shingled" and they overlap | ||||||||||||||||||||||||||||||||
| - Higher density and cheaper, but struggle during long sustained data writes (like resilvering) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <!-- footer: "don't bully me if this is wrong i don't know much about traditional RAID" --> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## RAID | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - Two main types: | ||||||||||||||||||||||||||||||||
| - Hardware | ||||||||||||||||||||||||||||||||
| - Software (`mdadm`) | ||||||||||||||||||||||||||||||||
| - All about "combining drives" and not much more | ||||||||||||||||||||||||||||||||
| - Still has different techniques | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <!-- footer: "" --> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## ZFS (Zettabyte File System) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - **Volume Manager + File System** | ||||||||||||||||||||||||||||||||
| - **COW (Copy-on-Write)**: crash consistency | ||||||||||||||||||||||||||||||||
| - **Block Checksums (bit rot)**: auto-heal from parity | ||||||||||||||||||||||||||||||||
| - **Smart ARC Caching** | ||||||||||||||||||||||||||||||||
| - **Snapshots**: fast & space efficient | ||||||||||||||||||||||||||||||||
| - **Fully software** | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## BTRFS | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - Evil (ripley made me include this even though it always breaks for me) | ||||||||||||||||||||||||||||||||
| - GPL (can be included in the kernel) vs CDDL (ZFS) | ||||||||||||||||||||||||||||||||
| - Similar features like COW, snapshots, checksums | ||||||||||||||||||||||||||||||||
| - Can add in drives after the fact | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <style scoped> | ||||||||||||||||||||||||||||||||
| li { | ||||||||||||||||||||||||||||||||
| font-size: 90%; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| </style> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <!-- footer: "<https://wintelguy.com/zfs-calc.pl>" --> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Common Terminology | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - **Parity**: Extra data used for redundancy | ||||||||||||||||||||||||||||||||
| - **Pool**: Top-level collection of VDEVs. One big "pool" of all your drives | ||||||||||||||||||||||||||||||||
| - **VDEV (Virtual Device)**: Group of physical disks | ||||||||||||||||||||||||||||||||
| - **Stripe**: Just combine disks, no redundancy (RAID 0) | ||||||||||||||||||||||||||||||||
| - **Mirror**: Same data on two drives (RAID 1) | ||||||||||||||||||||||||||||||||
| - **Striped Mirror**: Stripe pairs of mirrored disks (RAID 10) | ||||||||||||||||||||||||||||||||
| - **RAIDZ1**: Single parity (RAID 5) | ||||||||||||||||||||||||||||||||
| - **RAIDZ2**: Double parity (RAID 6) | ||||||||||||||||||||||||||||||||
| - **Dataset**: A "file system" in the pool | ||||||||||||||||||||||||||||||||
| - Metadata (compression, quotas) can differ from pool | ||||||||||||||||||||||||||||||||
| - **ZVol**: "raw block device" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <!-- footer: "" --> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ### DIY vs Managed ZFS: TrueNAS | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <style scoped> | ||||||||||||||||||||||||||||||||
| li { | ||||||||||||||||||||||||||||||||
| font-size: 50%; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| </style> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - Ease of use/setup | ||||||||||||||||||||||||||||||||
| - Nice monitoring UI out of the box | ||||||||||||||||||||||||||||||||
| - True Immutable | ||||||||||||||||||||||||||||||||
| - Mainly for NAS: application management not great | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ### DIY vs Managed ZFS: Cockpit (45Drives plugin) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <style scoped> | ||||||||||||||||||||||||||||||||
| li { | ||||||||||||||||||||||||||||||||
| font-size: 50%; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| </style> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - NOT immutable (cockpit runs anywhere as a web service) | ||||||||||||||||||||||||||||||||
| - Less focused | ||||||||||||||||||||||||||||||||
| - Still in pretty early development, docs don't exist | ||||||||||||||||||||||||||||||||
| - Only built for Rocky, Debian, and Ubuntu | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <center> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| </center> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ### DIY vs Managed ZFS: Manual | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - Much simpler than you would think | ||||||||||||||||||||||||||||||||
| - Full control & understanding | ||||||||||||||||||||||||||||||||
| - Works anywhere | ||||||||||||||||||||||||||||||||
| - Doesn't have a monitoring UI out of the box | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Creating a ZPool | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||||||||||
| sudo apt install zfsutils-linux | ||||||||||||||||||||||||||||||||
| ls -l /dev/disk/by-id/ | ||||||||||||||||||||||||||||||||
| sudo zpool create \ | ||||||||||||||||||||||||||||||||
| -o ashift=12 \ # for modern 4KB sector drives. should be 13 for 8K sectors | ||||||||||||||||||||||||||||||||
| -O compression=lz4 \ # or zstd, off, gzip | ||||||||||||||||||||||||||||||||
| -O atime=off \ # performance/drive health | ||||||||||||||||||||||||||||||||
| tank raidz1 \ # pool name and zfs config | ||||||||||||||||||||||||||||||||
| /dev/disk/by-id/ata-DRIVE1_______ \ # list which drives make up the pool | ||||||||||||||||||||||||||||||||
|
Comment on lines
+157
to
+161
|
||||||||||||||||||||||||||||||||
| -o ashift=12 \ # for modern 4KB sector drives. should be 13 for 8K sectors | |
| -O compression=lz4 \ # or zstd, off, gzip | |
| -O atime=off \ # performance/drive health | |
| tank raidz1 \ # pool name and zfs config | |
| /dev/disk/by-id/ata-DRIVE1_______ \ # list which drives make up the pool | |
| -o ashift=12 \ | |
| # for modern 4KB sector drives. should be 13 for 8K sectors | |
| -O compression=lz4 \ | |
| # or zstd, off, gzip | |
| -O atime=off \ | |
| # performance/drive health | |
| tank raidz1 \ | |
| # pool name and zfs config | |
| /dev/disk/by-id/ata-DRIVE1_______ \ | |
| # list which drives make up the pool |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is using zpool create/zpool set for dataset operations, but datasets are managed with zfs (e.g., zfs create tank/backups and zfs set compression=... tank/backups). As written, these commands will fail or do the wrong thing when followed literally.
| sudo zpool create tank/backups | |
| # optionally, change metadata: | |
| sudo zpool set compression=zstd tank/backups | |
| sudo zfs create tank/backups | |
| # optionally, change metadata: | |
| sudo zfs set compression=zstd tank/backups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this shell snippet, the line continuations won’t work if someone copy/pastes: in POSIX shells the
\must be the last character on the line (no trailing spaces, and you can’t put an inline comment after it). Consider moving the comments onto their own lines (or above each option) and leaving the backslash as the final character.