gmirror on FreeBSD 7

Prerequisites:

FreeBSD (Base + Autoconf, Automake, Bash and GCC)

gmirror  – Software RAID 1

Home: 

 

# New Way

# Example:
# I am using a Dell 670 with two (2) identical SATA hard drives I want to mirror
# The drives are known to the system as /dev/ad4 and /dev/ad6 as seen at boot time or by the dmesg command

# Boot up and log in as root
# Set security to allow these changes
sysctl kern.geom.debugflags=16

# Create the new mirror
gmirror label -v -b round-robin gm0 /dev/ad4

# Edit the /etc/fstab adding mirror and replacing all ad with gm
vi /etc/fstab


# Edit /boot/loader.conf

vi /boot/loader.conf


# Reboot
shutdown -r now

# Add the second disk to the mirror
gmirror insert gm0 /dev/ad6

# Check the status
gmirror status
gmirror list

# Reboot and verify operation
shutdown -r now
gmirror status
gmirror list

# Note: If you lock yourself out because of a typo in the fstab, do this to get read/write edit control:
mount -u
mount -a -t ufs
swapon -a
vi /etc/fstab
 

 

# Old Way

# Boot from a FreeBSD CD and choose "Fix-it" mode

 chroot /dist

 mount_devfs devfs /dev

 gmirror clear /dev/ad4

 gmirror clear /dev/ad6

 gmirror load

 gmirror label -v -b load gm0 /dev/ad4

 mount /dev/mirror/gm0s2a /mnt

 echo geom_mirror_load="YES" >> /mnt/boot/loader.conf

 echo swapoff="YES" >> /mnt/etc/rc.conf

 sed "s%ad4%mirror/gm0%" /mnt/etc/fstab > /mnt/etc/fstab.new

 mv /mnt/etc/fstab /mnt/etc/fstab.old

 mv /mnt/etc/fstab.new /mnt/etc/fstab

 gmirror insert gm0 /dev/ad6

 

See:
http://freebsdwiki.net/index.php/RAID1,_Software,_How_to_setup

gmirror list