RAIDが組まれたHDDの容量アップ
前の会社の社長から、社内ファイルサーバの容量アップ(320GB→500GB)を依頼されていたので今日出向いた。当該マシンにはFedora Core 2でRAID1が組まれている。まずは現状の確認から。
# cat fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/md1 / ext3 defaults 1 1
/dev/md0 /boot ext3 defaults 1 2
/dev/devpts /dev/pts devpts gid=5,mode=620 0 0
/dev/shm /dev/shm tmpfs defaults 0 0
/dev/proc /proc proc defaults 0 0
/dev/sys /sys sysfs defaults 0 0
/dev/md2 swap swap defaults 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,utf8,managed 0 0
/dev/hdd /media/cdrom auto pamconsole,exec,noauto,managed 0 0
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md1 282752104 250099568 18057892 94% /
/dev/md0 101018 12918 82884 14% /boot
/dev/shm 62560 0 62560 0% /dev/shm
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hdb2[1] hda2[0]
291892928 blocks [2/2] [UU]
md2 : active raid1 hdb3[1] hda3[0]
1052160 blocks [2/2] [UU]
md0 : active raid1 hdb1[1] hda1[0]
104320 blocks [2/2] [UU]
unused devices: <none>
手順としてはまず、起動可能なHDDを残して片方を新しいHDDに交換 → fdiskコマンドで交換前と同様のパーティションを設定し、mdadmコマンドで同期 → 新しいHDDをブート可能にし、今度は最初に残したほうのHDDを交換 → 同様の処理を行なう、というもの。
システムをシャットダウンし、スレーブ側のHDDを新品に交換して起動。各パーティションを確認する。
# fdisk -l /dev/hda
Disk /dev/hda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 fd Linux raid autodetect
/dev/hda2 14 36352 291893017+ fd Linux raid autodetect
/dev/hda3 36353 36483 1052257+ fd Linux raid autodetect
# fdisk -l /dev/hdb
Disk /dev/hdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hdb doesn't contain a valid partition table
新しいHDDである/dev/hdbのパーティションを、/dev/hdaと同様に設定する。ただし、新しいHDDのほうが容量が大きいため、データ記録場所として使用するパーティションを設定する際には注意が必要。今回のケースでは、hdb1とhdb3のブロック数を同じに、hdb2はこの範疇で最大値になるようにする。
# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):
(※途中略)
Command (m for help): p
Disk /dev/hdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 13 104391 fd Linux raid autodetect
/dev/hdb2 14 60670 487227352+ fd Linux raid autodetect
/dev/hdb3 60671 60801 1052257+ fd Linux raid autodetect
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
あとはmdadmコマンドで一気に処理する。
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hda2[0]
291892928 blocks [2/1] [U_]
md2 : active raid1 hda3[0]
1052160 blocks [2/1] [U_]
md0 : active raid1 hda1[0]
104320 blocks [2/1] [U_]
unused devices: <none>
# mdadm /dev/md0 -a /dev/hdb1
mdadm: hot added /dev/hdb1
# mdadm /dev/md1 -a /dev/hdb2
mdadm: hot added /dev/hdb2
# mdadm /dev/md2 -a /dev/hdb3
mdadm: hot added /dev/hdb3
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hdb2[2] hda2[0]
291892928 blocks [2/1] [U_]
[>....................] recovery = 0.0% (271936/291892928) finish=232.2min speed=20918K/sec
md2 : active raid1 hdb3[2] hda3[0]
1052160 blocks [2/1] [U_]
resync=DELAYED
md0 : active raid1 hdb1[1] hda1[0]
104320 blocks [2/2] [UU]
unused devices: <none>
時間がかかりそうなので、このまま放置して続きはまた明日。
トラックバック(0)
このブログ記事を参照しているブログ一覧: RAIDが組まれたHDDの容量アップ
このブログ記事に対するトラックバックURL: http://somin.heteml.jp/mt/mt-tb.cgi/4425
コメントする