我有一个软件RAIDconfiguration(/ dev / md2),它已经从两个3TB磁盘(sda和sdb)分配了分区sda3和sdb3。 分区types是GPT而不是LVM,文件系统是ext4。 现在,根分区占用1TB,主分区(在RAID / dev / md3上的sda4和sdb4)占用1.8TB,我想调整根分区的大小,使其只占用250GB,并将可用空间分配给主分区。最终在md2中为250GB,在家中为2.5TB。 为了做到这一点,我读了使用mdadm和resize的数组卷将实现,但问题是,它只调整了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
但事实certificate,实际上实现resize,我需要失败,并从RAID设备删除分区,重新分区每个磁盘,加回到RAID设备和同步。
所以我尝试从这个网站的指示: http : //www.zedt.eu/tech/linux/resize-grow-mdadm-raid1-device/
而且还尝试从这个serverfault答案: 如何调整两个RAID-1分区?
我已经试过做所有的事情,resize与分开,但没有,分开发送错误,指出它不能识别该分区的文件系统,我读过别处,分开不支持ext4,但我不关心,我已经使用resize2fs调整了文件系统的大小,所以我需要做的就是调整分区的大小。 另外在一些示例中,我看到分割打印输出打印文件系统types和所有,但是当我打印我的,我没有得到任何的信息: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设备可以占用整个空间?
谢谢!