我目前正在学习 Linux 软件 RAID,并尝试执行我的第一个基本重新配置。目前,我在软件 RAID1 中有两个 3TB 硬盘。不幸的是,我配置不当。现在有两个 MD 设备,一个 /dev/md2 @ 1TB,一个 /dev/md3 @ 1.7TB。一个挂载到我的 /home/ 目录,另一个挂载到我的根目录。
在理想的情况下,我想修改它,以便将整个 2.7TB 安装为驱动器的根目录。
我目前有一个如下的磁盘设置:
$ fdisk -l
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 4096 16781311 16777216 8G Linux RAID
/dev/sda2 16781312 17829887 1048576 512M Linux RAID
/dev/sda3 17829888 2165313535 2147483648 1T Linux RAID
/dev/sda4 2165313536 5860533134 3695219599 1.7T Linux RAID
/dev/sda5 2048 4095 2048 1M BIOS boot
Partition table entries are not in disk order.
Disk /dev/sdb: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sdb1 4096 16781311 16777216 8G Linux RAID
/dev/sdb2 16781312 17829887 1048576 512M Linux RAID
/dev/sdb3 17829888 2165313535 2147483648 1T Linux RAID
/dev/sdb4 2165313536 5860533134 3695219599 1.7T Linux RAID
/dev/sdb5 2048 4095 2048 1M BIOS boot
Partition table entries are not in disk order.
Disk /dev/md1: 511.4 MiB, 536281088 bytes, 1047424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/md0: 8 GiB, 8581545984 bytes, 16760832 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/md3: 1.7 TiB, 1891818209280 bytes, 3694957440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/md2: 1023.9 GiB, 1099377410048 bytes, 2147221504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
并且 df 输出:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8037136 0 8037136 0% /dev
tmpfs 1611420 12368 1599052 1% /run
/dev/md2 1056634044 685900556 317036568 69% /
tmpfs 8057084 8 8057076 1% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 8057084 0 8057084 0% /sys/fs/cgroup
/dev/md1 498980 108471 364324 23% /boot
/dev/md3 1818357760 124756 1725842684 1% /home
tmpfs 1611420 0 1611420 0% /run/user/1000
我需要采取哪些步骤来实现这一目标?
谢谢您的帮助!
答案1
由于这些不是逻辑卷,因此您要实现的目标将很困难。您唯一能做的就是将 home 归档到其他磁盘/根文件系统,然后卸载 /home,删除 home 和 root 的分区,然后扩展 root 的分区,通过恢复控制台相应地更改起始/结束指针。您显然需要非常小心地处理此问题并相应地评估风险。
答案2
是的。将数据移至根目录、卸载并删除分区后,使用图形管理工具 gparted 来管理磁盘分区。使用此工具,您可以调整 / 分区的大小。