Rau*_*l G 6 linux raid opensuse mdadm parted
我配置了一个软件 raid (/dev/md2),它从两个 3TB 磁盘(sda 和 sdb)分配了分区 sda3 和 sdb3。分区类型是 GPT 而不是 LVM,文件系统是 ext4。现在,根分区占用 1TB,主分区(raid /dev/md3 上的 sda4 和 sdb4)占用 1.8TB,我想将根分区的大小调整为仅占用 250GB 并将可用空间分配给主分区,所以最终 md2 中的 root 为 250GB,home 为 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
Run Code Online (Sandbox Code Playgroud)
为此,我按照本网站中的说明进行操作: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
Run Code Online (Sandbox Code Playgroud)
但后来事实证明,为了实际实现调整大小,我需要失败并从raid设备中删除分区,重新分区每个磁盘,添加回raid设备并同步。
所以我尝试了这个网站的说明:http : //www.zedt.eu/tech/linux/resize-grow-mdadm-raid1-device/
并且还尝试了这个服务器故障答案: 如何调整两个 RAID-1 分区的大小?
我已经尝试做所有这些,用 parted 调整大小,但没有,parted 发送错误,指出它无法识别分区的文件系统,我在其他地方读过 parted 不支持 ext4 但我不支持注意,我已经使用 resize2fs 调整了文件系统的大小,所以我需要做的就是调整分区的大小。同样在一些示例中,我看到 parted 打印输出来打印文件系统类型等等,但是当我打印我的时,我没有得到任何信息: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
Run Code Online (Sandbox Code Playgroud)
如您所见,我没有获得有关文件系统或名称的信息,如果我想调整分区 3(sda3 和 sdb3)的大小,我会收到错误消息,同样我无法增加分区 4 以容纳可用空间。
任何人都可以帮助我如何调整磁盘大小以便我的 RAID 设备可以占用全部空间?
谢谢!
小智 1
我使用这种方法得到了很好的结果:
http://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid
问候
| 归档时间: |
|
| 查看次数: |
1640 次 |
| 最近记录: |