*md-RAID 修復 *5台ミラーを4台ミラーに変更 *1台追加予定 !md から故障ディスクを除去 *ルートファイルシステム /dev/md0 [root@c2q nonaka]# df / Filesystem 1K-blocks Used Available Use% Mounted on /dev/md0 20512508 10878964 9423864 54% / *スワップ /dev/md1 [root@c2q nonaka]# cat /proc/swaps Filename Type Size Used Priority /dev/md1 partition 523964 434904 -1 *故障ディスク [root@c2q nonaka]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdg1[4] sdc1[9] sdd1[11] sda1[12] 20971392 blocks super 1.0 [5/4] [_UUUU] bitmap: 1/1 pages [4KB], 65536KB chunk md1 : active raid1 sdg2[8] sdc2[10] sdd2[11] sda2[13] 523968 blocks super 1.1 [5/4] [U_UUU] unused devices: [root@c2q nonaka]# mdadm --grow /dev/md1 -n4 raid_disks for /dev/md1 set to 4 [root@c2q nonaka]# mdadm --grow /dev/md0 -n4 raid_disks for /dev/md0 set to 4 [root@c2q nonaka]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdg1[4] sdc1[9] sdd1[11] sda1[12] 20971392 blocks super 1.0 [4/4] [UUUU] bitmap: 1/1 pages [4KB], 65536KB chunk md1 : active raid1 sdg2[8] sdc2[10] sdd2[11] sda2[13] 523968 blocks super 1.1 [4/4] [UUUU] unused devices: !2台 追加 [root@c2q nonaka]# ( hdparm -I /dev/sdi ; hdparm -I /dev/sdk ) | grep -e /dev/ -e Model -e GB /dev/sdi: Model Number: TOSHIBA DT01ACA200 device size with M = 1000*1000: 2000398 MBytes (2000 GB) /dev/sdk: Model Number: ST6000DM003-2CY186 device size with M = 1000*1000: 6001175 MBytes (6001 GB) *2T と 6T を追加 *マザーボードが旧タイプのため 2T からしか起動できない。 *2T をRAID1に組み込む *6T は全領域をデータ用に利用 !2Tを追加 *他の2Tディスクからパーティションテーブルをコピー sfdisk -d /dev/sda | sfdisk /dev/sdi *https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools *警告発生 [root@c2q nonaka]# sfdisk -d /dev/sda | sfdisk /dev/sdi Checking that no-one is using this disk right now ... OK Disk /dev/sdi: 243201 cylinders, 255 heads, 63 sectors/track /dev/sdi: unrecognized partition table type Old situation: No partitions found New situation: Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sdi1 * 2048 41945087 41943040 fd Linux raid autodetect /dev/sdi2 41945088 42993663 1048576 fd Linux raid autodetect /dev/sdi3 42993664 3907029167 3864035504 8e Linux LVM /dev/sdi4 0 - 0 0 Empty Warning: partition 1 does not end at a cylinder boundary sfdisk: I don't like these partitions - nothing changed. (If you really want this, use the --force option.) *https://unix.stackexchange.com/questions/155942/sfdisk-dont-like-partitions-want-to-dump-another-hard-drive-to-restore-softwa ""The requirement to align to cylinder boundaries has been gone for a long time now. ""シリンダ境界に合わせる制限は過去の遺物です。 *警告を無視して強制実行 [root@c2q nonaka]# sfdisk -d /dev/sda | sfdisk --force /dev/sdi Checking that no-one is using this disk right now ... OK Disk /dev/sdi: 243201 cylinders, 255 heads, 63 sectors/track /dev/sdi: unrecognized partition table type Old situation: No partitions found New situation: Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sdi1 * 2048 41945087 41943040 fd Linux raid autodetect /dev/sdi2 41945088 42993663 1048576 fd Linux raid autodetect /dev/sdi3 42993664 3907029167 3864035504 8e Linux LVM /dev/sdi4 0 - 0 0 Empty Warning: partition 1 does not end at a cylinder boundary Successfully wrote the new partition table Re-reading the partition table ... If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 (See fdisk(8).) *ルートファイルシステムのパーティション md0 に /dev/sdi0 を追加 *スワップのパーティション md1 に /dev/sdi1 を追加 *作業前 [root@c2q nonaka]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdg1[4] sdc1[9] sdd1[11] sda1[12] 20971392 blocks super 1.0 [4/4] [UUUU] bitmap: 1/1 pages [4KB], 65536KB chunk md1 : active raid1 sdg2[8] sdc2[10] sdd2[11] sda2[13] 523968 blocks super 1.1 [4/4] [UUUU] unused devices: *md0 作業 mdadm --grow /dev/md0 --raid-devices=5 --add=/dev/sdi0 [root@c2q nonaka]# mdadm --grow /dev/md0 --raid-devices=5 --add /dev/sdi1 mdadm: added /dev/sdi1 raid_disks for /dev/md0 set to 5 [root@c2q nonaka]# mdadm --grow /dev/md1 --raid-devices=5 --add /dev/sdi2 mdadm: added /dev/sdi2 raid_disks for /dev/md1 set to 5 *作業後ミラー中 [root@c2q nonaka]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdi1[5] sdg1[4] sdc1[9] sdd1[11] sda1[12] 20971392 blocks super 1.0 [5/4] [UUUU_] [==>..................] recovery = 10.9% (2291200/20971392) finish=5.4min speed=57329K/sec bitmap: 1/1 pages [4KB], 65536KB chunk md1 : active raid1 sdi2[4] sdg2[8] sdc2[10] sdd2[11] sda2[13] 523968 blocks super 1.1 [5/4] [UUUU_] resync=DELAYED *作業後ミラー完了 [root@c2q nonaka]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdi1[5] sdg1[4] sdc1[9] sdd1[11] sda1[12] 20971392 blocks super 1.0 [5/5] [UUUUU] bitmap: 1/1 pages [4KB], 65536KB chunk md1 : active raid1 sdi2[4] sdg2[8] sdc2[10] sdd2[11] sda2[13] 523968 blocks super 1.1 [5/5] [UUUUU] !6Tを追加 *6T は丸ごとデータ *参考 [root@c2q nonaka]# parted /dev/sdb print Model: ATA TOSHIBA MD04ACA4 (scsi) Disk /dev/sdb: 4001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 4001GB 4001GB primary lvm *実行 [root@c2q nonaka]# parted /dev/sdk mklabel gpt Information: You may need to update /etc/fstab. [root@c2q nonaka]# parted /dev/sdk mkpart primary 1 100% Information: You may need to update /etc/fstab. [root@c2q nonaka]# parted /dev/sdk set 1 lvm on Information: You may need to update /etc/fstab. *確認 [root@c2q nonaka]# parted /dev/sdk print Model: ATA ST6000DM003-2CY1 (scsi) Disk /dev/sdk: 6001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 6001GB 6001GB primary lvm *LVM に 6T を追加 [root@c2q nonaka]# pvcreate /dev/sdk1 Physical volume "/dev/sdk1" successfully created [root@c2q nonaka]# vgs VG #PV #LV #SN Attr VSize VFree vg_data 7 1 0 wz--n- 13.78t 3.27t [root@c2q nonaka]# vgextend vg_data /dev/sdk1 Volume group "vg_data" successfully extended [root@c2q nonaka]# vgs VG #PV #LV #SN Attr VSize VFree vg_data 8 1 0 wz--n- 19.24t 8.73t