Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How safe is it to use mdadm to hot add to rootfs raid
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sirlark
Guru
Guru


Joined: 25 Oct 2004
Posts: 306
Location: Limerick, Ireland

PostPosted: Wed May 04, 2011 10:08 am    Post subject: How safe is it to use mdadm to hot add to rootfs raid Reply with quote

I have a two identical hdds in a home server machine. They are each partitioned identically: boot, root, swap. On initial install, I set up the root partition as a mirror RAID over /dev/sda2 (root) and /dev/sdb2 (root), boot is /dev/sda1, and swap is /dev/sda3. I then added an extra drive for backup storage, and my drives got renamed. The new drive became /dev/sda. I have changed grub to point to /dev/sdb1 for the boot partition and the fstab uses /dev/sdb3 for swap.

Code:
mdadm --detail /dev/md0
tells me that the RAID has only one active drive now. My question is simply if it's safe to to hot add the old /dev/sdb2 (not /dev/sdc2) to the RAID, specifically will the newly added drive be overwritten with the current contents, or is it possible that the newly added drive, being originally a drive in the array, would somehow cause the RAID to synchronize to the stale data on /dev/sdc2 (the newly added drive)

The command I'm thinking of running is

Code:
mdadm -A /dev/md0 -a /dev/sdc2


Thanks
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Wed May 04, 2011 10:23 am    Post subject: Reply with quote

mdadm is perfectly safe, just as dd is perfectly safe, unless of course you don't understand what will happen and you end up using it wrong, like holding a gun the wrong way and shooting yourself

Look at /proc/mdstat

It tells you which drive is currently in use. If you add a new drive, it will sync from the currently active drive, to the newly added drive, thus the contents on the added drive will be overwritten by the sync.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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