1. Mirroring root disk step by step

1.1 <Preparation>
2disk상황에서는 root disk를 미러링할 경우 replica를 양쪽 디스크에 설정을 하지만
하나의 디스크가 fail시 quorum rule을 만족을 못하기 때문에 single user mode로 부
팅이 된다.
이를 방지하기 위해서는 /etc/system 파일에 다음을 설정한다.


# vi /etc/system
set md:mirrored_root_flag=1


양쪽 디스크의 파티션을 동일하게 한다.
# prtvtoc /dev/rdsk/c0t0d0s2 > disk0.txt
# fmthard -s disk0.txt /dev/rdsk/c0t1d0s2
or
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2


# metadb -a -f -c 2 /dev/rdsk/c0t0d0s7 /dev/rdsk/c0t1d0s7

1.2  3개 HDD 이상
각 HDD마다 2개의 replica 를 구성한다.
# metadb -a -c 2 -f /dev/rdsk/c0t0d0s7  /dev/rdsk/c0t1d0s7  /dev/rdsk/c0t2d0s7


1.3 <Create mirror for root and swap file system>
1.3.1 root file system
# metainit -f d10 1 1 c0t0d0s0 <--- the root partition
# metainit d20 1 1 c0t1d0s0 <--- the mirror partition
# metainit d30 -m d10
# metaroot d30


(metaroot 명령어에 의해 /etc/system, /etc/vfstab 파일이 수정된다. 하지만
/etc/vfstab 파일중에서 / 에 해당하는 디바이스만 /dev/md/dsk/d0 와 같이 바뀌기
때문에 다른 파일시스템이 있는 경우에는 수동으로 직접 수정해야 한다.)


1.3.2 swap file system
# metainit -f d11 1 1 c0t0d0s1
# metainit d21 1 1 c0t1d0s1
# metainit d31 -m d11


1.4 <Edit /etc/vfstab>
1.4.1 update vfstab file
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d31 - - swap - no -
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -
/dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /var ufs 1 no -
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /export/home ufs 2


1.5 <Reboot the system>
# lockfs -fa
# reboot
you must reboot with a one-way mirror : do not create a 2 way mirror before
rebooting otherwise the system will crash because of the round robin manner in
which data is read.


1.6 <Attach the second sub mirror to the mirror>
# metattach d30 d20 <-- root file system
# metattach d31 d21 <-- swap

+ Recent posts