Re: How to resize RAID-1 partitions (mdraid)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roberto Ragusa writes:

I never used parted, so if I had to achieve what you want I'd try something
completely different.

You have to use something to adjust the size of the ext3 filesystem. Growing the underlying mdraid device is not sufficient. Once the underlying block device is larger, the ext3 filesystem needs to be grown, else it'll remain at its logical size, with no benefit.

I don't think that mdadm --grow adjusts the ext3 metadata on the partition to reflect its new size. Anything can be on a RAID block device, not just ext3. Something still needs to logically resize the ext3 filesystem.

Boot with some sort of rescue disk so you are not running from the disks.

Break the RAID eliminating the sdb partitions to be modified:
(md1 and md2 is my guess at the names)

mdadm /dev/md1 --fail /dev/sdb1
mdadm /dev/md2 --fail /dev/sdb2
mdadm /dev/md1 --remove /dev/sdb1
mdadm /dev/md2 --remove /dev/sdb2
mdadm /dev/md1 --grow -n 1
mdadm /dev/md2 --grow -n 1

Why do you need to --grow here?

So you now have md1 and md2 are a 1-disk RAID1, while md5 is still running
on two disks.

You now fdisk /dev/sdb: delete all the partitions and immediately recreate
them with the new sizes. Be sure that sdb4 and sdb5 are recreated with _exactly_
the same positions they had before. Do not use "fd" as type for sdb1 and sdb2,

Why not?

for now. Now save the changes. The kernel will refuse to load the new partitions
in memory as your md5 is still using sda5 and sdb5.

So you reboot.

Now you have again md1 (degraded) md2 (degraded) and md5 (2 disks!) available.
Create two new degraded RAID devices:

mdadm --create /dev/md11 -l 1 -n 1 /dev/sdb1
mdadm --create /dev/md12 -l 1 -n 1 /dev/sdb2

(mdadm will also want "-f" because n=1 is unusal)

Now you can mkfs /dev/md11 and /dev/md12 and cp from /dev/md1 and /dev/md2

I see what you're getting at here. I'm wondering whether it's even necessary to create temporary md devices and manually copy over. Can't I just create the partitions on the second drive, in their new position, add them to my existing RAID sets, and let the kernel sync up the data, then break the RAID volumes again, rebuild the partitions on the first drives, add them back into the RAID, sync the data back up to the primary, "--grow max", now that the first partition is larger on both drives, to have mdraid grow the RAID volume to its new bigger size, then finally parted to grow the ext3 filesystem on the larger RAID volume.

Then I have another server that does not have a luxury of a larger swap partition that can be conveniently shrunk. But I think I can see how that can be done using documented parted abilities: shrink the large ext3 partition using parted. Shrink its RAID device using mdadm --grow. Degrade the RAID by taking out the partition from one of the drives. Delete the physical partition and recreate it its new position. Add it back into the RAID volume, let the kernel sync it, then repeat the same process with the partition on the other drive.

Now, I just need to understand why you say not to use the fd partition type.


Attachment: pgpaRVMiB15IU.pgp
Description: PGP signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux