- 이번에는 raid1(mirrorring)을 구축해 보겠다.
- 기타등등은 raid0 구성하는 것과 거의 같으므로 생략한다(필자 블로그에서 raid0 구축방법 찾아보길 바란다)
- raid1은 아시다 싶이 미러링이다. 즉 2개의 디스크에 똑같은 내용을 쓴다.. 같은 내용을 2개의 디스크에 써야함으로 write 속도는 그닥 빠르지 않다. 그러나 read 속도는 빠르다. 2개의 디스크에서 읽어 올 수 있기 때문이다.
- 구축은 sdd1 과 sde1 을 만들고 mdadm 으로 구축하면 되겠다.
1) sdd1 과 sde1 을 파일시스템으로 만들고 파일시스템 유형은 Linux raid auto 로 준다.
[root@localhost ~]# fdisk /dev/sdd
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.
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.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-204, default 204):
Using default value 204
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-204, default 204):
Using default value 204
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sde
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.
Syncing disks.
[root@localhost ~]# fdisk /dev/sde
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.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-204, default 204):
Using default value 204
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-204, default 204):
Using default value 204
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Syncing disks.
2) 장치명을 주어야 한다. md1 을 찾아보고(md0 은 raid0 을 만드는데 쓰였다.) 없으면 mknod 명령으로 만들어준다.
[root@localhost ~]# ls -al /dev/md?
brw-r----- 1 root disk 9, 0 3??26 00:24 /dev/md0 <--- raid0 용
[root@localhost ~]# mknod /dev/md1 b 9 1
[root@localhost ~]# ls -al /dev/md?
brw-r----- 1 root disk 9, 0 3??26 00:24 /dev/md0
brw-r--r-- 1 root root 9, 1 3??26 01:20 /dev/md1 <--- raid1 용
brw-r----- 1 root disk 9, 0 3??26 00:24 /dev/md0 <--- raid0 용
[root@localhost ~]# mknod /dev/md1 b 9 1
[root@localhost ~]# ls -al /dev/md?
brw-r----- 1 root disk 9, 0 3??26 00:24 /dev/md0
brw-r--r-- 1 root root 9, 1 3??26 01:20 /dev/md1 <--- raid1 용
3) mdadm 명령으로 radi1 구성한다.
[root@localhost ~]# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd1 /dev/sde1
mdadm: array /dev/md1 started.
[root@localhost ~]# mdadm --detail --scan
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=6780793c:b171ede2:d0a38176:a24fbe36
devices=/dev/sdd1,/dev/sde1 <--- 방금 구성한 raid1
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=80ce56ed:8a0ca06d:d96d03b6:77ae5f91
devices=/dev/sdb1,/dev/sdc1 <--- 이전의 raid0
[root@localhost ~]#
mdadm: array /dev/md1 started.
[root@localhost ~]# mdadm --detail --scan
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=6780793c:b171ede2:d0a38176:a24fbe36
devices=/dev/sdd1,/dev/sde1 <--- 방금 구성한 raid1
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=80ce56ed:8a0ca06d:d96d03b6:77ae5f91
devices=/dev/sdb1,/dev/sdc1 <--- 이전의 raid0
[root@localhost ~]#
4) md1 을 파일시스템 만들고 /raid1로 마운트한다.
[root@localhost ~]# mkfs.ext3 /dev/md1
mke2fs 1.37 (21-Mar-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
52208 inodes, 208768 blocks
10438 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
26 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801
mke2fs 1.37 (21-Mar-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
52208 inodes, 208768 blocks
10438 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
26 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkdir /raid1
[root@localhost ~]# mount /dev/md1 /raid1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.7G 2.4G 4.0G 38% /
/dev/shm 147M 0 147M 0% /dev/shm
/dev/md0 395M 11M 365M 3% /raid0
/dev/md1 198M 5.8M 182M 4% /raid1
[root@localhost ~]#
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkdir /raid1
[root@localhost ~]# mount /dev/md1 /raid1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.7G 2.4G 4.0G 38% /
/dev/shm 147M 0 147M 0% /dev/shm
/dev/md0 395M 11M 365M 3% /raid0
/dev/md1 198M 5.8M 182M 4% /raid1
[root@localhost ~]#
5) /etc/fstab 에 추가 하면 끝
[root@localhost ~]# vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext3 defaults 1 1
/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/md0 /raid0 ext3 defaults 1 1
/dev/md1 /raid1 ext3 defaults 1 1 <--- 추가된것
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
/dev/hdc /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0
LABEL=/ / ext3 defaults 1 1
/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/md0 /raid0 ext3 defaults 1 1
/dev/md1 /raid1 ext3 defaults 1 1 <--- 추가된것
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
/dev/hdc /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0

댓글목록
등록된 댓글이 없습니다.