Skip to content

Instantly share code, notes, and snippets.

@drGrove
Last active June 13, 2024 19:29
Show Gist options
  • Save drGrove/d2ae30276758a300b4d8bc84ec3c56b3 to your computer and use it in GitHub Desktop.
Save drGrove/d2ae30276758a300b4d8bc84ec3c56b3 to your computer and use it in GitHub Desktop.
RAID Cheatsheet
# RAID Cheatsheet
Findings along my way of managing my own NAS and RAID
1. Re-Assembling a RAID when the disks are avaiable but not active
```sh
mdadm --assemble --scan --verbose --force
```
Generally if it thinks everythings a space it will try and fail to start up the RAID,
adding force ensures that all found disks get addedto the RAID
## Increase RAID size
1. Add the drive to the ARRAY
```sh
mdadm /dev/md127 --add /dev/sdd1
```
2. Grow the array
```sh
mdadm --grow --raid-devices=<num devices> --spares=<num spares> --backup-file=/root/md127_grow.bak /dev/md127
```
3. Wait until the raid finishes
```sh
watch cat /prod/mdstat
```
4. Grow the PV
```sh
pvresize /dev/md127
```
5. Grow the LV
```sh
lvexend -l +100%FREE /dev/<pv>/<lv>
```
6. Increae the LUKS partiition
```sh
cryptsetup resize <crypt> -d /path/too/file.key
```
7. Increase BTRFS size
```sh
btrfs filesystem resize max /path/to/fs
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment