RAID1を使用してLinuxパーティションのサイズを変更するには?

RAID1を使用してLinuxパーティションのサイズを変更するには?

130Gb LVMイメージを含むProxmoxディスクがあります。 235GBディスクに移動しました。 Proxmoxでサイズを変更してください。完璧。

しかし、私のLinuxディストリビューションでは、パーティションはまだ130Gbです(ディスクは235Gbになります)。

パーティション: /dev/sda1 /dev/sdb1

RAID1 ボリュームの一部です: /dev/md0

データを失うことなく130 Gbから235 Gbにサイズを変更する正しい方法は何ですか?

**root@debian:~# fdisk -l**

Disk /dev/sdb: 235 GiB, 252329328640 bytes, 492830720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd098f1da

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 273436671 273434624 130.4G fd Linux raid autodetect
/dev/sdb2       273436672 291502079  18065408   8.6G fd Linux raid autodetect

Disk /dev/sda: 235 GiB, 252329328640 bytes, 492830720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x559572cb

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 273436671 273434624 130.4G fd Linux raid autodetect
/dev/sda2       273436672 291502079  18065408   8.6G fd Linux raid autodetect

Disk /dev/md0: 130.3 GiB, 139864309760 bytes, 273172480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md1: 8.6 GiB, 9241100288 bytes, 18049024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


**root@debian:~# cat /proc/mdstat**
Personalities : [raid1]
md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
      9024512 blocks super 1.2 [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      136586240 blocks super 1.2 [2/2] [UU]
      bitmap: 0/2 pages [0KB], 65536KB chunk

unused devices: <none>


**root@debian:~# cat /proc/partitions**
major minor  #blocks  name

   8       16  246415360 sdb
   8       17  136717312 sdb1
   8       18    9032704 sdb2
   8        0  246415360 sda
   8        1  136717312 sda1
   8        2    9032704 sda2
  11        0    1048575 sr0
   9        0  136586240 md0
   9        1    9024512 md1

私は成功せずに試しました。

**root@debian:~# mdadm --grow --size max /dev/md0**
mdadm: component size of /dev/md0 unchanged at 136586240K
unfreeze

**root@debian:~# resize2fs /dev/md0**
resize2fs 1.43.3 (04-Sep-2016)
The filesystem is already 34146560 (4k) blocks long.  Nothing to do!

ベストアンサー1

だから誰かが必要な場合。私は働く方法を見つけました。私はそれを使用しましたsystemrescuecd

最初のステップは、sda1/2RAID1からそれを削除することです。

mdadm /dev/md0 --fail /dev/sda1
mdadm /dev/md1 --fail /dev/sda2
mdadm /dev/md0 --remove /dev/sda1
mdadm /dev/md1 --remove /dev/sda2

/dev/sda2Gpartedから削除した後(systemrescuecd経由)

GpartedのSDA1から「boot」と「raid」のタグを削除しました。

次に、コマンドラインで次の操作を行います。

Parted /dev/sda
resizepart
1
245000
quit

Gparted linux-swapからsda2を生成します。

mdadm --add /dev/md0 /dev/sda1
mdadm --add /dev/md1 /dev/sda2

sdb1/2も同様です。

後ろに:

e2fsck -f /dev/sda1
e2fsck -f /dev/sdb1

そして:

mdadm --grow --size max /dev/md0

その後、GPartedのmd0で"check"を使用しました。

完璧。うまくいきます。

おすすめ記事