Last active
February 13, 2021 05:38
-
-
Save rhizome/4ae9c9aeaa9b054860fa5d639f250416 to your computer and use it in GitHub Desktop.
Resizing a RAID 1 mirror on Debian with mdadm, fdisk, and resize2fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logical Structure: | |
# +-----------------------------------+ | |
# | +--------------------------+ | | |
# | | +------------+ | | | |
# | RAID | Partition | Filesystem | | | | |
# | | +------------+ | | | |
# | +--------------------------+ | | |
# +-----------------------------------+ | |
# unmount RAID | |
umount /media/All | |
# remove the drive to be enlarged or swapped out | |
# be sure to specify only the partition device, not the entire drive device | |
mdadm /dev/md1 --fail /dev/sdb1 --remove /dev/sdb1 | |
# delete partition and recreate larger one on top of existing data. data will survive. | |
# steps: https://unix.stackexchange.com/posts/320454/revisions | |
fdisk /dev/sdb | |
# partitions are now the same size. enlarge the RAID config | |
mdadm --grow /dev/md1 -z max | |
# check the RAID for errors | |
e2fsck -f /dev/md1 -y | |
# enlarge the RAID filesystem | |
resize2fs /dev/md1 | |
# mount the RAID | |
mount -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment