Score:0

Creating a new RAID1 array partition same size as existing disk

us flag

I have an existing raid1 array on a pair of 3TB drives.

~  cat /proc/mdstat
Personalities : [raid1] 
md127 : active raid1 sde1[0] sdc1[1]
      2930133440 blocks super 1.2 [2/2] [UU]
      bitmap: 5/22 pages [20KB], 65536KB chunk

I also have a pair of 14TB drives.

I want to partition the 14TB drives into the exact size of the 3TB drives so I can create another raid1 array with mdadm and then use btrfs raid0 on top to get RAID10.

How do I create a partition on the 14TB with the same size as the 3TB disk?

Are there any pitfalls which make this process different from looking up the size of the 3TB disk and applying that to the 14TB disk?

Score:0
us flag

Okay I tried figuring this out on my own but it didn't work well. But I now have an error which makes Googling for the right answer easier:

[root@fedora lb]# mdadm --manage /dev/md127 --add /dev/sdf2 
mdadm: /dev/sdf2 not large enough to join array

[root@fedora lb]# sudo blockdev --report /dev/md127 
RO    RA   SSZ   BSZ        StartSec            Size   Device
rw   256   512  4096               0   3000456642560   /dev/md127
[root@fedora lb]# sudo blockdev --report /dev/sdf2
RO    RA   SSZ   BSZ        StartSec            Size   Device
rw   256   512   512     21484494848   3000458264064   /dev/sdf2

[root@fedora lb]# blockdev --getsz /dev/sdf2
5860270047
[root@fedora lb]# blockdev --getsz /dev/md127 
5860266880

although it seems like the space I allocated is larger I'm assuming the error message is the same--it just means there is a size mismatch

edit: okay so it turns out that you can't use the size of the created RAID device. You have to use the size of the partition or disk that was used in the RAID device. So one would need to use either sde1 or sdc1 in this case. After learning how to use blockdev and fdisk -l I should have done this:

blockdev --getsz /dev/sde1

# not this! blockdev --getsz /dev/md127

This is the full list of operations that I had to do:

gdisk /dev/sdf # create new partition; fd00 format

# swap disks from different manufacturer
mdadm --manage /dev/md127 --add /dev/sdf2
mdadm --manage /dev/md127 --fail /dev/sde1
mdadm --manage /dev/md127 --remove /dev/sde1

cat /proc/mdstat
mdadm --detail /dev/md127

mdadm --create --level=1 --raid-devices=2 /dev/md2 /dev/sdg2 /dev/sde1

sudo btrfs device add -f /dev/sdc /mnt/d
sudo btrfs balance start -dconvert=raid0 -mconvert=raid1 /mnt/d

mdadm --detail --scan | tee -a /etc/mdadm/mdadm.conf
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.