Skip to content

Instantly share code, notes, and snippets.

@ytjohn
Created October 11, 2017 15:18
Show Gist options
  • Save ytjohn/27b055d1aa5704818fe17d1479ce36d8 to your computer and use it in GitHub Desktop.
Save ytjohn/27b055d1aa5704818fe17d1479ce36d8 to your computer and use it in GitHub Desktop.
replacing raid 1 mdadm
# copy partition table and randomize GUUID
# https://askubuntu.com/a/57922/94764
# existing good drive = sdb
# replaced empty drive = sda
sgdisk /dev/sdb -R /dev/sda
sgdisk -G /dev/sda
cat /proc/mdstat
#######################
Personalities : [raid1]
md124 : active raid1 sdb4[1]
2822640640 blocks super 1.2 [2/1] [_U]
bitmap: 4/22 pages [16KB], 65536KB chunk
md125 : active raid1 sdb3[1]
1953728 blocks super 1.0 [2/1] [_U]
bitmap: 0/1 pages [0KB], 65536KB chunk
md126 : active raid1 sdb2[1]
7812096 blocks super 1.2 [2/1] [_U]
md127 : active raid1 sdb1[1]
97655808 blocks super 1.2 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
#####################
# Add partitions back into place
mdadm --manage /dev/md124 --add /dev/sda4
mdadm --manage /dev/md125 --add /dev/sda3
mdadm --manage /dev/md126 --add /dev/sda2
mdadm --manage /dev/md127 --add /dev/sda1
# watch the rebuild, hope sdb
# watch -n30 cat /proc/mdstat
Every 30.0s: cat /proc/mdstat Wed Oct 11 11:14:06 2017
Personalities : [raid1]
md124 : active raid1 sda4[2] sdb4[1]
2822640640 blocks super 1.2 [2/1] [_U]
[>....................] recovery = 0.4% (12539456/2822640640) finish=421.7min speed=111046K/sec
bitmap: 4/22 pages [16KB], 65536KB chunk
md125 : active raid1 sda3[2] sdb3[1]
1953728 blocks super 1.0 [2/1] [_U]
resync=DELAYED
bitmap: 0/1 pages [0KB], 65536KB chunk
md126 : active raid1 sda2[2] sdb2[1]
7812096 blocks super 1.2 [2/1] [_U]
resync=DELAYED
md127 : active raid1 sda1[2] sdb1[1]
97655808 blocks super 1.2 [2/1] [_U]
resync=DELAYED
bitmap: 1/1 pages [4KB], 65536KB chunk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment