Senin, 23 Juni 2014

RAID-1 (mirror) on FreeNAS

Although FreeNAS will mount boot disk in read-only but there could still be a chance that boot disk goes wrong. Traditional way to fix a broken boot disk is reinstall FreeNAS on a new boot disk and import backup config. However, this method may introduces longer downtime, and in worst case the backup config may not even up-to-date.

Using RAID-1 (mirror) on boot disk is a good choice to reduce such kind of impact, and usually can be done through hardware raid card. if there is no hardware raid card, software RAID is also a good choice. However, during or after installation, there is no option in the menu to create software RAID for boot disk.

Luckily, FreeNAS is based on FreeBSD that provides super easy way to setup a software RAID manually. Here comes steps,

Assume boot disk is SATA "/dev/ada0" and mirror disk is SATA "/dev/ada1". From the console, select 9 to launch a shell, then enter following commands.

# sysctl kern.geom.debugflags=16

# gmirror label -v -b round-robin gm0 /dev/ada0

# gmirror insert gm0 /dev/ada1

System will automatically rebuild the newly added disk, /dev/ada1, and the disk status will show DEGRADED. For example,

# gmirror status

      Name    Status  Components

mirror/gm0  DEGRADED  ada0

                      ada1 (64%)

After automatic rebuild, disk status will become COMPLETE. For example,

# gmirror status

      Name    Status  Components

mirror/gm0  COMPLETE  ada0 (ACTIVE)

                      ada1 (ACTIVE)

In case the boot disk (assume "/dev/ada0" is broken) and needs to be replaced, here comes procedures,

# gmirror forget gm0 /dev/ada0

[unplug /dev/ada0, and plug a new disk]

# gmirror insert gm0 /dev/ada0

The system will again automatically rebuild /dev/ada0. During the rebuilding, system can keep running without problem.


FreeNAS loads geom_gmirror module by default, and uses geom_label in /etc/fstab rather than physical disk name. Hence there is no need to modify /boot/loader.conf and /etc/fstab.

Forget about it. This procedure does not work.

Tidak ada komentar:

Posting Komentar

Silahkan beri komentar ?