Home > 備忘録 > Raid に関すること > Raid の新規構築( 79 )
稼働中のシステムに2台のHDD(2T)を追加して、データ用Raid1(ミラーリング)を構築する手順を記録する。追加したHDDは/homeにmountすることにする。
[root@server]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 11 18:43:10 2010
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_leom-lv_root / ext4 defaults,acl 1 1
/dev/mapper/vg_leom-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0fdisk でのパーティションの切りかたは、別のサイトで確認してください。ここでは、省略します。
[root@server]# mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm: partition table exists on /dev/sdb1 but will be lost or
meaningless after creating array
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: partition table exists on /dev/sdc1 but will be lost or
meaningless after creating array
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.[root@server]# mkfs.ext4 -j /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
122101760 inodes, 488378100 blocks
24418905 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
14905 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.次のコマンドで同期の進捗状況を確認できる。
[root@server]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
1953512400 blocks super 1.2 [2/2] [UU]
[>....................] resync = 1.2% (23460096/1953512400) finish=688.0min speed=46754K/sec
unused devices: <none>DEVICE /dev/sd1
ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1[root@server]# mount /dev/md0 /mnt ←RAIDアレイを/mntに仮マウント
[root@server]# rsync -av /home/ /mnt//dev/md0 /home ext4 defaults,acl 0 0[root@server]# mount
/dev/mapper/vg_leom-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/md0 on /home type ext4 (rw,acl)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
[root@server ~]# df -h
Filesystem Size Used Avail Use% マウント位置
/dev/mapper/vg_leom-lv_root
99G 34G 60G 37% /
tmpfs 496M 260K 496M 1% /dev/shm
/dev/sda1 194M 60M 125M 33% /boot
/dev/md0 1.8T 33G 1.7T 2% /home