Have you ever thought of making soft RAID for low-end servers? You may have thought about the redundancy of your workstation with disk mirroring without purchasing a hard RAID control card. Have you ever had painful configuration experiences that deterred you from soft RAID on Unix systems?
The FreeBSD 5.3 and higher versions are added to Gmirror (8); it lets you easily configure the use of soft RAID 1. Although Gmirror has many tutorials, I find that they do not require Bsdlabel to manually calculate the size of a partition to use a floppy disk to correct an existing system.
I thought it would be more reasonable to configure RAID during the installation of the operating system. I also hope that the configuration steps are easy to understand and do not cause human errors such as computational errors. By piecing together the existing explanatory text and experimenting with multiple configurations on my own, I found the configuration steps that apply to several different systems. I also got valuable feedback from the Gmirror writer, Pawel Jakub Dawidek, who revealed Gmirror some of the features that have not been made public.
GEOM Background knowledge
Before you introduce the configuration steps, it is useful to know the GEOM first. GEOM is the modular disk architecture introduced by FreeBSD 5.0. The module architecture allows you to manipulate the disk by writing a program. The soft RAID program introduced in FreeBSD 5.3 is the best example.
Gstripe (8) can be done RAID 0
Gmirror (8) can be done RAID 1
GRAID3 (8) can be done RAID 3
The first character g above indicates that these programs are using the GEOM.
Note: If you do not know what raid is, refer to Webopedia for a link to define different raid http://www.webopedia.com/TERM/R/RAID.html.
Man 4 Geom The disk terminology used by Geom, and we'll see some of that in the process of setting up gmirror. They include:
Provider-The GEOM entity appears under/dev. This article describes how to create the/DEV/MIRROR/GM0 this provider, which represents disk mirroring or duplex.
Consumer-This entity receives I/O requests. In the case of mirror/duplex, this refers to the two-piece hard drive. I used two data cables to connect two IDE hard drives respectively, get/dev/ad0 and/dev/ad2.
Metadata (metadata)--in different RAID, it includes the array members and their size, location, logical disk and partition description and the current state of the disk array.
Mirrored/Duplex-RAID 1 keeps the data consistent between the two hard drives. In other words, it shoots a hard drive's data mirror to another hard drive. If two hard disks are connected to a single IDE cable, they are called mirrors, and if two hard disks are connected to different data lines, they are called duplex. Because a single data line is easy to cause a single point of failure, so the use of duplex is accounted for the majority.
Configure mirroring/duplex during installation of the operating system
If you plan to use RAID 1 to avoid complications, purchase two identical hard disks (the same model and size). If the model or size is inconsistent, things will become very complex, even after a difficult configuration, in the end, you can only waste a larger hard drive out of space. Take one as the first main disk and the other as the second main disk, and pick up the two-piece hard drive. Before installing the operating system, check again to see if the CMOS has recognized two hard drives.
Install FreeBSD any version (5.3 or more) as you like. When you go to the Select drives (Selected hard disk) menu, ad0 and ad2 are displayed. Select Ad0, because you will install the operating system on the master disk.
After you enter the Fdisk interface, delete all existing partitions and choose Use entire disk (using the entire disc). When prompted to start the menu, select the Standard MBR (Standard MBR).
When you come to the Disklabel interface, partition the AD0 as you want. If you don't know what to do, select a to have the system automatically partitioned. Then select the preset installation kit and install the media source to allow the operating system to be installed as usual.
After installation, browse to Postinstall configurations (after installation configuration) Set your time zone, create user account, set root password and so on.
However, when you return to the Sysinstall main menu, do not rush to reboot the system. Press ALT-F4 to enter the command prompt line. We first type the CSH command so we get a history shell (the default shell is Bourne).
Creating a mirror/duplex is simple, just type:
# gmirror Label-v-B round-robin gm0/dev/ad0
Where the Gmirror label creates a mirror;-V opens verbose mode;-b round-robin selects the balance algorithm (currently the Round-robin algorithm performs best); Gm0 is the name of the Mirror/Duplex (which represents the first GEOM mirror);/dev/ad0 represents The source disk used for the mirror shot.
However, if you type the command now, you will be disappointed.
# gmirror Label-v-B round-robin gm0/dev/ad0
Can ' t store metadata on/dev/ad0:operation not permitted
(Unable to save metadata on/DEV/AD0: Prohibit operation)