LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-31-2009, 04:25 AM   #1
MrAngel
LQ Newbie
 
Registered: Oct 2009
Posts: 8

Rep: Reputation: 0
mdadm - forgot to set up partitions


Hi,
The problem here is entirely my fault - adding an extra disk at an odd time in the morning, I think I missed out a step.

Original setup: /dev/md0 is a raid5 array, 3 disks, 500GB each, /dev/sd[bcd].

Hardware modification: Added 2 new disks, 1TB each.

Intended change: Add /dev/sd[ef]1 to /dev/md0. Create /dev/md1 using /dev/sd[ef]2.

What actually happened: Added /dev/sd[ef] to /dev/md0. I think I should have partitioned it first, but only realized this after doing all the LVM stuff and resize2fs.


So ... how do I make use of the remaining 500GB on my newer disks?

My first guess would be to remove one drive from the array, partition it properly, and then re-add it. Is this a sane solution? Is it possible to turn a /dev/sde into /dev/sde1 without losing the data on it? I never really used partitions before, so I'm not sure how to go about this.

I guess if all else fails, I can just knock one disk out of the array, fdisk, and rebuild the array as if I'd replaced the disk. Or am I missing something really obvious here?
 
Old 10-31-2009, 07:18 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Replace the first disk with 1 TB as well? So you end up with a 1 TB RAID5 array without partitions...

That was just an idea.

I don't see the difference between the last to options you propose, but it seems sound anyway. Take one disk out of the RAID, repartition and add the new partition to the RAID, rebuild. Once that it finished, do the same for the second new one.

BTW, what are you doing with the additional 500 GB you have on the new disks? Using them unRAIDed?

jlinkels
 
Old 11-04-2009, 09:21 AM   #3
MrAngel
LQ Newbie
 
Registered: Oct 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jlinkels View Post
Replace the first disk with 1 TB as well? So you end up with a 1 TB RAID5 array without partitions...

That was just an idea.
Probably the most elegant solution. I don't quite have the money for another 3 new disks right now, though.

Quote:
Originally Posted by jlinkels View Post
I don't see the difference between the last to options you propose, but it seems sound anyway. Take one disk out of the RAID, repartition and add the new partition to the RAID, rebuild. Once that it finished, do the same for the second new one.
If I had a spare disk, I could do something like:
fdisk /dev/sdg (create 2 500GB partitions on the extra disk)
dd if=/dev/sde of=/dev/sdg1

Then use /dev/sdg1 to replace /dev/sde in the raid config, and repeat for the other unpartitoned disk.

As far as I understand it, if I repartition my sde and then add sde1 to the array where sde was, I'd have to rebuild the 'new' disk as if I was replacing a failed one. That means no redundancy for 24 hours, and I'd rather not do that if there's any alternative.

So, the question could be restated as:

Is it possible to partition my disk so that /dev/sde1 contains the data formerly found in /dev/sde? Does this just work anyway?

Quote:
Originally Posted by jlinkels View Post
BTW, what are you doing with the additional 500 GB you have on the new disks? Using them unRAIDed?

jlinkels
OK ... I must be missing something big here. The new disks have not been partitioned. I just added /dev/sde and /dev/sdf to the raid array using mdadm. I don't see any way I could be using the extra 500GB until I've poked at them with fdisk.

If I'm missing something obvious here, please give me a pointer.
 
Old 11-04-2009, 04:09 PM   #4
latinmusic74
Member
 
Registered: Jun 2007
Posts: 118

Rep: Reputation: 16
Do not you need to:

1. Partition the disks
2. Add a system file to the disk: RAID "df"
3. Format the partition and run partprobe or reboot the server.
4. then #mdadm -a /dev/md.. /dev/sd..
 
Old 11-05-2009, 06:13 AM   #5
MrAngel
LQ Newbie
 
Registered: Oct 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by latinmusic74 View Post
Do not you need to:

1. Partition the disks
Yes ... I've not got that far yet, though. I was asking whether this will lose the data already on the disk, and if so whether there's any way not to.

Quote:
Originally Posted by latinmusic74 View Post
2. Add a system file to the disk: RAID "df"
OK ... now I'm confused. What's a system file?

Quote:
Originally Posted by latinmusic74 View Post
3. Format the partition and run partprobe or reboot the server.
Thanks for informing me about partprobe, I've not seen that before.
Why/how do I need to format the partition?



So far, the plan I've got is:
Code:
# umount /home/amedia/
# mdadm --stop /dev/md0
mdadm: fail to stop array /dev/md0: Device or resource busy

(and this is where I'm not sure what to do next)

# fdisk /dev/sde
  (new partition, primary, 1, cylinders 1-60801)
  (new partition, primary, 2, cylinders 60802-end)
  (save)
# partprobe
# mdadm --assemble /dev/md0 /dev/sdb /dev/sdc /dev/sdd /dev/sdf /dev/sde1
  (I assume that it will rebuild the data on sde from the other ones)
  (wait for it to finish)
# mdadm --stop /dev/md0
# fdisk /dev/sdf
  (new partition, primary, 1, cylinders 1-60801)
  (new partition, primary, 2, cylinders 60802-end)
  (save)
# partprobe
# mdadm --assemble /dev/md0 /dev/sdb /dev/sdc /dev/sdd /dev/sdf1 /dev/sde1
  (wait for it to finish again)

# mdadm --create /dev/md1 --raid-devices=2 --level=5 /dev/sde1 /dev/sdf1
# pvscan
# vgextend VolGroup02 /dev/md1
# lvresize VolGroup02/Media 100%VG
# resize2fs -p /dev/VolGroup02/Media
  (and wait some more)
# mount /home/amedia/
So ... can anyone point out the flaws in my plan?
 
  


Reply

Tags
mdadm, raid5



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM over 2xRAID-1 (mdadm/software) partitions. FS corruption VenKamikaze Linux - Server 3 04-16-2009 06:59 AM
Partitions missing on startup after mdadm snafu KingPong Linux - Hardware 6 01-31-2009 04:06 AM
MDADM screws up the LVM partitions? Can't mount the LVMs after mdadm stopped alirezan1 Linux - Newbie 3 11-18-2008 04:42 PM
mdadm, images over loopback, raid5, can't create partitions emat Linux - Software 1 05-03-2007 03:46 PM
Forgot how I set up a specific ESSID justanothersteve Linux - Wireless Networking 3 05-18-2006 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration