0

I have a server that has a software RAID without LVM. That is only mdadm.

There are the partitions /dev/sda2 and /dev/sdb2 which form /dev/md2.

There is also a lot of space after both /dev/sda2 and /dev/sdb2 (almost 2TB)

What I want to do is resize /dev/md2 and take up all the space that is on the right of those to partitions.

The bad part is that /dev/md2 is my / mount, so I can do things only via rescue-pro mode (OVH server).

Is there a way to resize /dev/md2? If "yes", how?

By the way, the partitions are EXT4.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
alexandernst
  • 534
  • 3
  • 9
  • 21
  • http://unix.stackexchange.com/questions/53400/resize-non-lvm-ext4-root-partition – gtirloni Sep 11 '14 at 16:53
  • @gtirloni So, that would be (in parted) `rm 2`, `mkpart primary `. Reboot. `e2fsck -f /dev/sda2` then `resize2fs /dev/sda2`. And that for `sdb2`. ? – alexandernst Sep 11 '14 at 22:23
  • 2
    Don't fsck a component of a working raid device! Resize both component partitions first, then (after reboot) run "mdadm --grow --size=max /dev/md2", _then_ you can resize2fs /dev/md2 (fsck is not needed when doing an online resize to a larger size). – wurtel Sep 12 '14 at 07:11
  • @wurtel There is a problem. I can't `modprome md` in the rescue-pro mode in OVH. Can I run `mdadm --grow --size=max /dev/md2` while running the OS? (md2 contains my `/`) – alexandernst Sep 12 '14 at 07:17
  • 1
    Running mdadm --grow on an active device is not a problem in my experience. I've done that on active webservers remotely in the past. – wurtel Sep 12 '14 at 07:23
  • @wurtel Great! One last question: If I have 2 partitions and part 1 starts at 50s and ends at 300s and part 2 starts at 800s and ends at 1000s, what should I type for in "mkpart primary 50 " to fill up the entire space between the 2 partitions without overlapping the part 2? 800 or 799? (s == sectors) – alexandernst Sep 12 '14 at 07:26
  • 1
    Hmm, not my area of expertise, I usually use fdisk which handles these details for me. I would choose 799 just to be safe. – wurtel Sep 12 '14 at 07:29
  • @wurtel I just resized both partitions and then rebooted, but now my server isn't going up, so I went to rescue mode again and did "print all" in parted and now I see my partitions with the right size, but there is no `/dev/md2`, instead there is `/dev/md3`! Why did it change it's name and how do I rename it? – alexandernst Sep 13 '14 at 10:53
  • Check the answer to [this] [1] question. [1]: http://superuser.com/questions/346719/how-to-change-the-name-of-an-md-device-mdadm – wurtel Sep 14 '14 at 11:48

0 Answers0