반응형
CentOS7 RAID 1+0 생성
# 이전 포스팅 2개가 있습니다. 참고하실 분들은 참고하시면 좋을 것 같습니다.
이번 포스팅에서는 설명을 최대한 간소화하였습니다.
[ 개념 마려우신 분들은 아래 리읔에서 보시고 오면 좋을 것 같아요!! ]
1. lsblk 로 디스크 확인
2. fdisk 로 파티션 생성 ( raid 용 )
3. mdadm 을 통해 RAID1을 2개 ( sdi1 & sdj1 // sdk1 & sdl1 )
4. mdadm 을 통해 RAID1 2개를 RAID0 으로 묶어주기
5. 파일 시스템 포맷 -> 마운트 디렉터리 생성 -> 마운트 -> /etc/fstab 설정하여 auto-mount (재부팅 후에도 자동으로)
6. 재부팅 후 df -h 로 /etc/fstab 설정이 잘 되었나 확인.
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 17.5G 0 part
│ ├─centos-root 253:0 0 7.5G 0 lvm /
│ └─centos-home 253:1 0 10G 0 lvm /home
└─sda3 8:3 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdd 8:48 0 20G 0 disk
└─sdd1 8:49 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sde 8:64 0 20G 0 disk
└─sde1 8:65 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdf 8:80 0 20G 0 disk
└─sdf1 8:81 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdg 8:96 0 20G 0 disk
└─sdg1 8:97 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdh 8:112 0 20G 0 disk
└─sdh1 8:113 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdi 8:128 0 20G 0 disk
sdj 8:144 0 20G 0 disk
sdk 8:160 0 20G 0 disk
sdl 8:176 0 20G 0 disk
sr0 11:0 1 73.7M 0 rom
sr1 11:1 1 942M 0 rom
# 파티션 생성
[root@localhost ~]# fdisk /dev/sdi
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x929d7942.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdj
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xdddc33fc.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdk
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb5c32c37.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdl
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x449daf6c.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 파티션 생성 후 확인해보기
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 17.5G 0 part
│ ├─centos-root 253:0 0 7.5G 0 lvm /
│ └─centos-home 253:1 0 10G 0 lvm /home
└─sda3 8:3 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdd 8:48 0 20G 0 disk
└─sdd1 8:49 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sde 8:64 0 20G 0 disk
└─sde1 8:65 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdf 8:80 0 20G 0 disk
└─sdf1 8:81 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdg 8:96 0 20G 0 disk
└─sdg1 8:97 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdh 8:112 0 20G 0 disk
└─sdh1 8:113 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdi 8:128 0 20G 0 disk
└─sdi1 8:129 0 20G 0 part
sdj 8:144 0 20G 0 disk
└─sdj1 8:145 0 20G 0 part
sdk 8:160 0 20G 0 disk
└─sdk1 8:161 0 20G 0 part
sdl 8:176 0 20G 0 disk
└─sdl1 8:177 0 20G 0 part
sr0 11:0 1 73.7M 0 rom
sr1 11:1 1 942M 0 rom
# RAID 1 생성 ( 경고창 가볍게 y로 무시 )
[root@localhost ~]# mdadm --create /dev/md11 --level=1 --raid-devices=2 /dev/sdi1 /dev/sdj1
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
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md11 started.
[root@localhost ~]# mdadm --create /dev/md12 --level=1 --raid-devices=2 /dev/sdk1 /dev/sdl1
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
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md12 started.
# RAID0 으로 RAID1을 묶어 씀
[root@localhost ~]# mdadm --create /dev/md10 --level=0 --raid-devices=2 /dev/md11 /dev/md12
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md10 started.
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 17.5G 0 part
│ ├─centos-root 253:0 0 7.5G 0 lvm /
│ └─centos-home 253:1 0 10G 0 lvm /home
└─sda3 8:3 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 20G 0 part
└─md1 9:1 0 20G 0 raid1 /mnt/md1
sdd 8:48 0 20G 0 disk
└─sdd1 8:49 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sde 8:64 0 20G 0 disk
└─sde1 8:65 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdf 8:80 0 20G 0 disk
└─sdf1 8:81 0 20G 0 part
└─md5 9:5 0 40G 0 raid5 /mnt/raid5
sdg 8:96 0 20G 0 disk
└─sdg1 8:97 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdh 8:112 0 20G 0 disk
└─sdh1 8:113 0 20G 0 part
└─md6 9:6 0 40G 0 raid6 /mnt/md6
sdi 8:128 0 20G 0 disk
└─sdi1 8:129 0 20G 0 part
└─md11 9:11 0 20G 0 raid1
└─md10 9:10 0 40G 0 raid0
sdj 8:144 0 20G 0 disk
└─sdj1 8:145 0 20G 0 part
└─md11 9:11 0 20G 0 raid1
└─md10 9:10 0 40G 0 raid0
sdk 8:160 0 20G 0 disk
└─sdk1 8:161 0 20G 0 part
└─md12 9:12 0 20G 0 raid1
└─md10 9:10 0 40G 0 raid0
sdl 8:176 0 20G 0 disk
└─sdl1 8:177 0 20G 0 part
└─md12 9:12 0 20G 0 raid1
└─md10 9:10 0 40G 0 raid0
sr0 11:0 1 73.7M 0 rom
sr1 11:1 1 942M 0 rom
# 파일시스템 포맷
[root@localhost ~]# mkfs.ext4 /dev/md10
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
2621440 inodes, 10467840 blocks
523392 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2157969408
320 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# 마운트 디렉터리 생성 후 마운트
[root@localhost ~]# mkdir /mnt/md10
[root@localhost ~]# mount /dev/md10 /mnt/md10
# /etc/fstab 자동 마운트 설정
[root@localhost ~]# vi /etc/fstab
- vi /etc/fstab ( auto-mount 설정 )
맨 아래 줄
/dev/md10 /mnt/md10 ext4 defaults 0 0 // 추가
wq로 저장
반응형
'OS,Network,Container' 카테고리의 다른 글
리눅스 명령어 모음 (6) | 2020.04.17 |
---|---|
리눅스 LVM 기본 개념 ( Logical Volume Manager ) (0) | 2020.04.17 |
CentOS7 RAID 5 구성, parted (9) | 2020.04.16 |
리눅스 tar 아카이브란? tar 개념, 실습 (2) | 2020.04.15 |
CentOS7 RAID1 구성, RAID 개념 (0) | 2020.04.15 |