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

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

 



Roberto Ragusa writes:

Sam Varshavchik wrote:
That bad news, since these are existing partitions, so presumably the
raid metadata is at the end.

The good news is that I took a look at the current parted online manual,
and it looks like there's some support in parted now. The current
version of parted seems to accept /dev/mdX as a parameter, and the
resize command is documented. So, I think what I need to do is:

1) Use parted to shrink the filesystem on /dev/mdX

2) Use mdadm --grow to reduce the size of the /dev/mdX array

3) Go back to parted, and use the "move" command to reduce the size of
the partition on both disks. Not the "resize" command, because I already
resized the filesystem, right?

Your first mail did not really describe what you want. The plan
in your last mail seems to imply a few details.

You say "resize". Is it enlarge or shrink? It seems it is "shrink".

Both. My disk is full. I need to shrink one thing, and grow something else.

What other partitions you have on the disks?

The disk partitions are as follows:

Device /dev/sda1 /boot 100 megabytes
/dev/sda2 /     20 gigabytes
/dev/sda3 swap - 6 gigs
/dev/sda4 Extended partition
/dev/sda5 /home -- remaining space, large

The layout of /dev/sdb is the same, and each partition on /dev/sda is in a RAID-1 array with its peer on /dev/sdb.

All partitions, except for /dev/sda4, have their types set to "Linux raid autodetect" in the partition table.

That small /boot is getting to be a pain, when updating Fedora. I originally wanted to shrink /home by 400-500 megabytes, getting some free space appear before it, shifting the remain partitions over, then adding the free space at the end of /boot.

But I just realized that I can simply shrink the swap partition by half a gig, or so, at its beginning, and move / up.

So, what I think I need to do is:

1) Drop the swap partition

2) Use mdadm --grow to reduce the size of /dev/md2 (RAID-1 joining /dev/sda3 and /dev/sdb3) by about a gigabyte

3) Change the size of this partition in the partition table, make it smaller by about half a gig.

4) Move the partition physically so that it ends where it used to end.

Can parted do 3 & 4? It's not clear to me what parted does with swap partitions, whether it just refuses to touch them, or just treats them as an opaque blob. I think it's better to move the partition together with its data. Even though this is swap, there's a RAID signature in there, and it'll probably be easier to just move the partition, as is, rather than me having to figure out how to completely drop and then create a new RAID-1 partition.

5) Use mdadm --grow --size=max, to extend the size of the partition to whatever mdadm thinks it should be now, then mkswap-ing an empty swap partition on the raid device

6) Move /dev/sd[ab]2 up. Parted can obviously do it.

7) Change the size of the /dev/sd[ab]1 partitions.

8) Use mdadm --grow --size=max to grow /dev/md0 to absorb the larger size of the underlying partitions.

9) Use parted to grow /boot to the larger size of the /dev/md0 array.

What I don't understand is how to change the size of an existing partition without touching its contents. All the actual ext3 partitions are on the virtual /dev/mdX devices. Logically, they are not on the underlying partitions. parted's docs seem to suggest that parted will want to move the data in the partition around, when it resizes an existing partition. I think, if I understand its concepts correctly, that I need to do that on /dev/md, not on the /dev/sd partitions. However, it goes without saying that if I'm simply moving a partition on a disk, without changing its size, I need to obviously move the data in the partition, as is, accordingly.

Attachment: pgp6z2yYFAXhc.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