기술 가이드

7 /dev/hda 준비 및 GRUB 설정

3 min read 리눅스 업데이트됨 17 Oct 2025
RAID1: /dev/hda 준비와 GRUB 설정
RAID1: /dev/hda 준비와 GRUB 설정

짧게: /dev/hda 파티션 타입을 RAID 자동감지(fd)로 변경하고, 해당 파티션들을 각 md 디바이스에 추가한 뒤 mdadm.conf와 GRUB 부트 항목을 업데이트합니다. 동기화가 완료될 때까지 확인하고 initrd를 재생성한 다음 재부팅하면 RAID1로 부팅됩니다.

개요

이 가이드는 이미 /dev/md0, /dev/md1, /dev/md2가 존재하고 동기화 중이거나 동기화가 완료된 상태에서, /dev/hda의 파티션을 RAID로 구성하고 GRUB을 이중 부팅 가능하도록 조정하는 절차를 다룹니다. 주요 도구: fdisk, mdadm, vi, mkinitrd.

중요: 아래 명령은 루트 권한으로 실행해야 합니다. 실수로 잘못된 디스크를 수정하면 데이터 손실이 발생할 수 있으니 대상 디스크명을 반드시 확인하세요.

1) 현재 상태 확인

먼저 파일시스템과 RAID 상태를 확인합니다.

df -h
[root@server1 ~]# df -h  
Filesystem            Size  Used Avail Use% Mounted on  
/dev/md2              4.4G  757M  3.4G  18% /  
/dev/md0              167M  9.0M  150M   6% /boot  
[root@server1 ~]#

다음으로 md 상태를 확인합니다:

cat /proc/mdstat
[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hdb5[1]  
      417536 blocks [2/1] [_U]  
  
md0 : active raid1 hdb1[1]  
      176576 blocks [2/1] [_U]  
  
md2 : active raid1 hdb6[1]  
      4642688 blocks [2/1] [_U]  
  
unused devices:   
[root@server1 ~]#

위 예시는 hdb 쪽이 활성 멤버이고 hda 쪽은 아직 추가되지 않은 상태입니다.

2) /dev/hda 파티션 타입을 RAID로 변경

fdisk를 실행하여 /dev/hda의 파티션 타입을 fd (Linux raid autodetect)로 변경합니다.

fdisk /dev/hda

예시 대화(프롬프트 응답은 화살표로 표시하지 않고 설명 목적으로만 표기):

[root@server1 ~]# fdisk /dev/hda  
  
Command (m for help):  <--- t  
Partition number (1-6):  <--- 1  
Hex code (type L to list codes):  <--- fd  
Changed system type of partition 1 to fd (Linux raid autodetect)  
  
Command (m for help):  <--- t  
Partition number (1-6):  <--- 5  
Hex code (type L to list codes):  <--- fd  
Changed system type of partition 5 to fd (Linux raid autodetect)  
  
Command (m for help):  <--- t  
Partition number (1-6):  <--- 6  
Hex code (type L to list codes):  <--- fd  
Changed system type of partition 6 to fd (Linux raid autodetect)  
  
Command (m for help):  <--- w  
The partition table has been altered!  
  
Calling ioctl() to re-read partition table.  
Syncing disks.  
[root@server1 ~]#

Note: fdisk에서 파티션 번호와 변경 내용을 정확히 확인하세요. 변경 후 커널이 파티션 테이블을 다시 읽도록 합니다.

3) /dev/hda 파티션을 RAID에 추가

이제 hda의 파티션들을 각각의 md 디바이스에 추가합니다:

mdadm --add /dev/md0 /dev/hda1
mdadm --add /dev/md1 /dev/hda5
mdadm --add /dev/md2 /dev/hda6

추가 후 /proc/mdstat을 확인하면 동기화(리빌드)가 시작된 것을 볼 수 있습니다:

cat /proc/mdstat
[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hda5[2] hdb5[1]  
      417536 blocks [2/1] [_U]  
        resync=DELAYED  
  
md0 : active raid1 hda1[0] hdb1[1]  
      176576 blocks [2/2] [UU]  
  
md2 : active raid1 hda6[2] hdb6[1]  
      4642688 blocks [2/1] [_U]  
      [======>..............]  recovery = 34.4% (1597504/4642688) finish=1.0min speed=50349K/sec  
  
unused devices:   
[root@server1 ~]#

실시간으로 확인하려면:

watch cat /proc/mdstat

watch를 종료하려면 CTRL+C를 누르세요.

동기화가 완료되면 다음과 같이 모든 배열이 [UU] 상태가 됩니다:

[root@server1 ~]# cat /proc/mdstat  
Personalities : [raid1]  
md1 : active raid1 hda5[0] hdb5[1]  
      417536 blocks [2/2] [UU]  
  
md0 : active raid1 hda1[0] hdb1[1]  
      176576 blocks [2/2] [UU]  
  
md2 : active raid1 hda6[0] hdb6[1]  
      4642688 blocks [2/2] [UU]  
  
unused devices:   
[root@server1 ~]#

4) /etc/mdadm.conf 업데이트

원본 설정을 덮어쓰고 현재 배열 정보를 덧붙입니다.

cp -f /etc/mdadm.conf_orig /etc/mdadm.conf
mdadm --examine --scan >> /etc/mdadm.conf

이제 /etc/mdadm.conf는 배열의 UUID와 레벨 정보를 포함해야 합니다. 예시 출력:

cat /etc/mdadm.conf
# mdadm configuration file
#
# mdadm will function properly without the use of a configuration file,
# but this file is useful for keeping track of arrays and member disks.
# In general, a mdadm.conf file is created, and updated, after arrays
# are created. This is the opposite behavior of /etc/raidtab which is
# created prior to array construction.
#
#
# the config file takes two types of lines:
#
#       DEVICE lines specify a list of devices of where to look for
#         potential member disks
#
#       ARRAY lines specify information about how to identify arrays so
#         so that they can be activated
#
# You can have more than one device line and use wild cards. The first
# example includes SCSI the first partition of SCSI disks /dev/sdb,
# /dev/sdc, /dev/sdd, /dev/sdj, /dev/sdk, and /dev/sdl. The second
# line looks for array slices on IDE disks.
#
#DEVICE /dev/sd[bcdjkl]1
#DEVICE /dev/hda1 /dev/hdb1
#
# If you mount devfs on /dev, then a suitable way to list all devices is:
#DEVICE /dev/discs/*/*
#
#
#
# ARRAY lines specify an array to assemble and a method of identification.
# Arrays can currently be identified by using a UUID, superblock minor number,
# or a listing of devices.
#
#       super-minor is usually the minor number of the metadevice
#       UUID is the Universally Unique Identifier for the array
# Each can be obtained using
#
#       mdadm -D 
#
#ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
#ARRAY /dev/md1 super-minor=1
#ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
#
# ARRAY lines can also specify a "spare-group" for each array.  mdadm --monitor
# will then move a spare between arrays in a spare-group if one array has a failed
# drive but no spare
#ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df spare-group=group1
#ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 spare-group=group1
#
# When used in --follow (aka --monitor) mode, mdadm needs a
# mail address and/or a program.  This can be given with "mailaddr"
# and "program" lines to that monitoring can be started using
#    mdadm --follow --scan & echo $! > /var/run/mdadm
# If the lines are not found, mdadm will exit quietly
#MAILADDR [email protected]
#PROGRAM /usr/sbin/handle-mdadm-events
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=6b4f013f:6fe18719:5904a9bd:70e9cee6
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=63194e2e:c656857a:3237a906:0616f49e
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=edec7105:62700dc0:643e9917:176563a7

(파일의 UUID 값은 귀하의 시스템에 따라 다릅니다.)

5) GRUB 설정 수정 (GRUB 파트 2)

목표: 시스템이 hdb가 실패해도 hda로 부팅할 수 있도록 /boot/grub/menu.lst의 첫 번째 커널 항목을 복사하여 hd1을 hd0으로 바꾸고, 나머지 항목은 주석 처리합니다.

편집 예시:

vi /boot/grub/menu.lst

아래와 같이 보이도록 수정합니다:

timeout 10
color black/cyan yellow/cyan
default 0
fallback 1

title linux
kernel (hd1,0)/vmlinuz BOOT_IMAGE=linux root=/dev/md2  resume=/dev/md1
initrd (hd1,0)/initrd.img

title linux
kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/md2  resume=/dev/md1
initrd (hd0,0)/initrd.img

#title linux
#kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/hda6  resume=/dev/hda5
#initrd (hd0,0)/initrd.img

#title failsafe
#kernel (hd0,0)/vmlinuz BOOT_IMAGE=failsafe root=/dev/hda6  failsafe
#initrd (hd0,0)/initrd.img

주의: GRUB에서 hd0이 /dev/hda, hd1이 /dev/hdb에 매핑되는 것을 확인하세요. 일부 하드웨어/부트로더 환경에서는 장치 매핑이 다를 수 있습니다.

6) initrd 업데이트 및 재부팅

initrd를 백업하고 현재 커널용 initrd를 다시 생성합니다:

mv /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img_orig2
mkinitrd /boot/initrd-`uname -r`.img `uname -r`

이후 시스템을 재부팅합니다:

reboot

정상적으로 부팅되면 작업이 완료된 것입니다.

점검 및 검증 체크리스트

  • /proc/mdstat에서 모든 md가 [UU] 상태인지 확인
  • /etc/mdadm.conf에 ARRAY 라인이 존재하는지 확인
  • /boot/grub/menu.lst에 hd0(=hda) 부팅 항목이 포함되어 있는지 확인
  • [ ] /boot/initrd-uname -r.img가 새로 생성되었는지 확인
  • 재부팅 후 콘솔에서 부팅이 정상인지 확인

문제 해결(간단한 가이드)

  • 동기화가 매우 느린 경우: I/O 부하나 드라이브 상태를 확인하세요. mdadm –detail /dev/mdX로 상태를 점검합니다.
  • GRUB에서 잘못된 디스크로 부팅되는 경우: GRUB 프롬프트에서 root와 geometry를 확인하고 /boot의 장치 매핑을 재검토하세요.
  • mdadm –examine이 UUID를 반환하지 않으면: 슈퍼블록이 없는 파티션일 수 있으니 mdadm –create로 재생성 전에 백업을 고려하세요.

중요: 복구 절차는 시스템별로 다릅니다. 데이터가 중요하면 변경 전에 전체 백업을 권장합니다.

관리자를 위한 명령 치트시트

  • md 상태 확인: cat /proc/mdstat
  • 배열 상세: mdadm –detail /dev/md0
  • 배열에 디스크 추가: mdadm –add /dev/md0 /dev/sdX1
  • 배열에서 디스크 제거: mdadm –manage /dev/md0 –fail /dev/sdX1 && mdadm –manage /dev/md0 –remove /dev/sdX1
  • mdadm.conf 갱신: mdadm –examine –scan >> /etc/mdadm.conf

요약

이 문서에서는 /dev/hda의 파티션을 Linux RAID 자동감지(fd)로 변경하고, 해당 파티션들을 md 장치에 추가하여 RAID1 동기화를 수행한 뒤 /etc/mdadm.conf와 GRUB 설정을 업데이트하여 두 드라이브 모두로 부팅 가능하도록 설정하는 전체 절차를 설명했습니다. 모든 단계는 루트 권한으로 신중히 수행하고, 변경 전 백업을 권장합니다.

마지막으로: 축하합니다 — 실행 중인 Mandriva 2008.0 시스템에 소프트웨어 RAID1을 성공적으로 설정했습니다!

공유하기: X/Twitter Facebook LinkedIn Telegram
저자
편집

유사한 자료

Debian 11에 Podman 설치 및 사용하기
컨테이너

Debian 11에 Podman 설치 및 사용하기

Apt-Pinning 간단 소개 — Debian 패키지 우선순위 설정
시스템 관리

Apt-Pinning 간단 소개 — Debian 패키지 우선순위 설정

OptiScaler로 FSR 4 주입: 설치·설정·문제해결 가이드
그래픽 가이드

OptiScaler로 FSR 4 주입: 설치·설정·문제해결 가이드

Debian Etch에 Dansguardian+Squid(NTLM) 구성
네트워크

Debian Etch에 Dansguardian+Squid(NTLM) 구성

안드로이드 SD카드 설치 오류(Error -18) 완전 해결
안드로이드 오류

안드로이드 SD카드 설치 오류(Error -18) 완전 해결

KNetAttach로 원격 네트워크 폴더 연결하기
네트워킹

KNetAttach로 원격 네트워크 폴더 연결하기