Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SOLVED: adding new drive to software raid array
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
plink212
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2005
Posts: 90

PostPosted: Tue Aug 24, 2010 6:09 pm    Post subject: SOLVED: adding new drive to software raid array Reply with quote

I have 3 software raids setup
Code:
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md3 : active raid10 sdf2[1] sdb2[5] sda2[0] sde2[2] sdd2[3]
      292675584 blocks 64K chunks 2 near-copies [6/5] [UUUU_U]
     
md4 : active raid5 sdf3[2] sdb3[5] sda3[0] sde3[3] sdd3[1]
      6837411200 blocks level 5, 64k chunk, algorithm 2 [6/5] [UUUU_U]
     
md0 : active raid1 sdf1[2] sdb1[0] sda1[5] sde1[3] sdd1[4]
      97536 blocks [6/5] [U_UUUU]
     
unused devices: <none>

as you can see one of my drives has failed and I need to replace it.
So I have a new drive which is /dev/sdc and I need to recreate the partition layout
This is the setup /dev/sda
Code:
Model: ATA ST31500341AS (scsi)
Disk /dev/sda: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  100MB   100MB   ext2         primary  raid
 2      100MB   100GB   99.9GB  xfs          primary  raid
 3      100GB   1500GB  1400GB               primary  raid

I launched parted on /dev/sdc and issued
Code:
(parted) mkpart primary 0 100M                                           
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore                                                     
(parted) mkpart primary 100M 100G                                   
(parted) mkpart primary 100G -1

but this ends up with
Code:
Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  100MB   100MB   ext2         primary
 2      101MB   100GB   99.9GB               primary
 3      100GB   1500GB  1400GB               primary

However when I try to add /dev/sdc2 to the array I get
Code:
mdadm --manage /dev/md3 --add /dev/sdc2
mdadm: /dev/sdc2 not large enough to join array

I am confused why 2 starts at 101MB and not 100MB like the first.

Help


Last edited by plink212 on Tue Aug 24, 2010 6:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
plink212
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2005
Posts: 90

PostPosted: Tue Aug 24, 2010 6:30 pm    Post subject: Reply with quote

hmm if anyone else comes across this there is a workaround

in parted type
Code:
unit s


you can then specify the sector locations for the start and the end
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Fri Aug 27, 2010 2:57 am    Post subject: Reply with quote

sfdisk makes it a lot easier to do this, as it can dump and recreate a partition table for you. Something like so:

Code:
sfdisk -d /dev/sda | sfdisk /dev/sdb


Where /dev/sda is a drive currently working and part of the array, and /dev/sdb is a brand new, unpartitioned drive. Afterwards you can just add the newly created partitions to the arrays.

A more general problem that's easy to run into here is if you get another drive that's the same size, but has different geometry (usually happens with different brands or models), this often means you can't create partitions that are of identical size, and all of the new partitions must be at least as large as the existing ones. To get around this, try making your swap partition(s) smaller, even if you also have those in RAID arrays, it shouldn't be a problem to swapoff and recreate them.
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
plink212
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2005
Posts: 90

PostPosted: Fri Aug 27, 2010 5:25 am    Post subject: Reply with quote

agreed it would if they were mbr disks.
these were gpt disks and I couldn't get it to run against them

Tim
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum