Now let's get our hands on having a mirror or RAID-1 with ZFS and FreeBSD.
- Well first off, we have to install the hard disk to your system and boot up
- Login as root
- Type in sysinstall
- Select Custom Installation
- Partition the Hard Disk (Use A = Use Entire Disk and Press Q = Quit)
- Label the Hard Disk (Use A = Auto Defaults)
- Select the /usr, /var, /tmp Mount Points one at a time and press D (Delete)
- Leave only the / and the swap partitions
- Press C to create a new partition and then type /anything as the Mount Point
- Select the newly created partition and press M (Mount pt) to clear the field by deleting /anything and then press on W to write on the disk and Q to quit
- Press on
- Exit from sysinstall
#zpool statusThen we add the 2nd drive to our mirror (our second drive comes up as ad6)
# zpool attach tank ad4s1d ad6s1dIt will now show the two hard disks on a mirror
# zpool status
pool: tankSeeing that we have a new mirror, we now copy the contents from our UFS slice to the second drive.
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
ad4s1d ONLINE 0 0 0
ad6s1d ONLINE 0 0 0
errors: No known data errors
# newfs /dev/ad6s1aNow supposed that we have a failure on the 1st HDD, we have configured the 2nd HDD to be ready.
# mkdir /mnt/bootdir
# mount /dev/ad6s1a /mnt/bootdir
# find -x /bootdir | cpio -pmd /mnt
We also have to stop fsck during the bootup process should the first HDD fail (in this case ad4). Edit /etc/fstab so our UFS slice is mounted in the right location for when ZFS boots.
We also NEED to make sure that the /bootdir/zfs/zpool.cache file is the same on both HDDs and edit /etc/fstab as:
/dev/ad4s1a /bootdir ufs rw 1 0And that's it!
/dev/ad6s1a /mnt/bootdir ufs rw 1 0
"Now What?"
No comments:
Post a Comment