Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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?
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
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
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.
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..
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
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
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/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.