linux – 调整RAID1磁盘阵列中的openSUSE 12.3 GPT ext4分区

我有一个软件raid配置(/ dev / md2),它从两个3TB磁盘(sda和sdb)分配了分区sda3和sdb3.
分区类型是GPT而不是LVM,文件系统是ext4.
现在,根分区占用1TB,主分区(raid / dev / md3上的sda4和sdb4)占用1.8TB,我想调整根分区的大小只需250GB,并将可用空间分配给主分区,所以它最终在md2中为250GB,在家中为2.5TB.
为此,我读到使用mdadm并调整数组卷的大小会实现这一点,但问题是它只调整了md2设备的大小,但sda3和sdb3中的可用空间未使用,我无法将其分配给sda4和sdb4所以我可以在md3中使用那个额外的空间,所以我有
At the beginning:
/dev/md2 with ext4,mounting / with quota of 1000GB
    sda3: 1000GB with ext4 using the full 1000GB
    sdb3: 1000GB with ext4 using the full 1000GB

/dev/md3 with ext4,mounting /home with quota of 1800GB
    sda4: 1800GB with ext4 using the full 1800GB
    sdb4: 1800GB with ext4 using the full 1800GB

I want:
/dev/md2 with ext4,mounting / with quota of 250GB
    sda3: 250GB with ext4 using the full 250GB
    sdb3: 250GB with ext4 using the full 250GB

/dev/md3 with ext4,mounting /home with quota of 2550GB
    sda4: 2550GB with ext4 using the full 2550GB
    sdb4: 2550GB with ext4 using the full 2550GB

And ended up with:
/dev/md2 with ext4,mounting / with quota of 250GB
    sda3: 1000GB with ext4 using only 250GB
    sdb3: 1000GB with ext4 using only 250GB

/dev/md3 with ext4,mounting /home with quota of 1800GB
    sda4: 1800GB with ext4 using the full 1800GB
    sdb4: 1800GB with ext4 using the full 1800GB

为此,我按照本网站上的说明操作:http://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid

所以,我在救援模式下重新启动,并以root身份运行以下命令:

#configure everything to edit the raid devices
modprobe linear
modprobe multipath
modprobe raid0
modprobe raid1
modprobe raid5
modprobe raid6
modprobe raid10
cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig
mdadm --examine --scan >> /etc/mdadm/mdadm.conf
mdadm -A --scan

### Shrink md2 from 1000GB to 250GB
#check the raid disk
e2fsck -f /dev/md2
#resize the file system from 1000GB to 245GB to leave room for the partition to shrink without issues
resize2fs /dev/md2 245G
#resize the partition from 1000GB to 250GB
mdadm --grow /dev/md2 --size=262144000
#resize the file system to fit the whole 250GB
resize2fs /dev/md2
#do a disk check again
e2fsck -f /dev/md2

### Grow md3 to include md2 750GB free space
#grow md3 to the max free space
mdadm --grow /dev/md3 --size=max
#run a disk check
e2fsck -f /dev/md3
#resize the file system
resize2fs /dev/md3
#check the file system again
e2fsck -f /dev/md3

但事实证明,为了实际实现调整大小,我需要失败并从raid设备中删除分区,重新分区每个磁盘,添加回raid设备并同步.

所以我试过这个网站上的说明:
http://www.zedt.eu/tech/linux/resize-grow-mdadm-raid1-device/

并尝试从这个serverfault回答:
How to resize two RAID-1 partitions?

我已经尝试了所有这些,调整大小与分开,但没有,parted发送错误表明它不能识别分区的文件系统,我已经阅读其他地方分手不支持ext4但我没有小心,我已经使用resize2fs调整了文件系统的大小,所以我需要做的就是调整分区大小.
另外在一些样品上,我看到分开的打印输出到打印文件系统类型和所有,但是当我打印我的时,我没有得到任何这些信息:
sda和sdb磁盘输出

Number  Start   End     Size    File system  Name  Flags
 5      1049kB  2097kB  1049kB                     bios_grub
 1      2097kB  12.9GB  12.9GB                     raid
 2      12.9GB  13.4GB  537MB                      raid
 3      13.4GB  1113GB  1100GB                     raid
 4      1113GB  3001GB  1888GB                     raid

正如您所看到的,我没有获得有关文件系统或名称的信息,如果我想调整分区3(sda3和sdb3)的大小,我会收到错误,同样我也无法增加分区4以适应可用空间.

任何人都可以帮助我如何调整我的磁盘大小,以便我的raid设备可以占用整个空间?

谢谢!

解决方法

相关文章

在Linux上编写运行C语言程序,经常会遇到程序崩溃、卡死等异...
git使用小结很多人可能和我一样,起初对git是一无所知的。我...
1. 操作系统环境、安装包准备 宿主机:Max OSX 10.10.5 虚拟...
因为业务系统需求,需要对web服务作nginx代理,在不断的尝试...
Linux模块机制浅析 Linux允许用户通过插入模块,实现干预内核...
一、Hadoop HA的Web页面访问 Hadoop开启HA后,会同时存在两个...