About Chapter 18 GEOM

Paulo Fragoso paulo at nlink.com.br
Wed Apr 12 13:48:09 UTC 2006


Hi,

We have a very simple solution to install FreeBSD using RAID1. Can you 
put this solution in Handbook? (My english is poor)

The simplicity is base on another a little FreeBSD instaled on other HD, 
in our case we are using a boot from network for diskless.

After installed all system on frist HD (ex.: /dev/ad4), partitioned how 
you like, we can boot from a little (temporary) FreeBSD system installed 
on /dev/ad0 (in our case we are booting from network).

Using this little system we can create a mirror device, using 
information from main HD, /dev/ad4:

gmirror label -vnb round-robin gm0 /dev/ad4
gmirror load

Now, we can add a second HD for this mirror (same size), in this case 
/dev/ad6, all partitions will be mirroed and you don't have to use dump 
and restore, which is hard work for several partiotions and labels:

gmirror configure -a gm0
gmirror insert gm0 /dev/ad6

Now, this mirror is running and we can edit the main fstab and to 
configure this system to work correctly:

mount /dev/mirror/gm0s1a /mnt
echo 'geom_mirror_load="YES"' >> /mnt/boot/loader.conf

vi /mnt/etc/fstab (change /dev/ad4 to /dev/mirror/gm0 in all lines)

Now we can boot normaly in main system /dev/ad4 and using mirror system, 
in our case:

$ df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/mirror/gm0s1a    243M     60M    163M    27%    /
devfs                 1.0K    1.0K      0B   100%    /dev
/dev/mirror/gm0s3h    134G    682K    124G     0%    /home
/dev/mirror/gm0s2d    248M     12K    228M     0%    /tmp
/dev/mirror/gm0s2f    2.9G    1.8G    929M    66%    /usr
/dev/mirror/gm0s2g    2.2G    108M    1.9G     5%    /usr/local
/dev/mirror/gm0s2e    496M    194K    456M     0%    /var
/dev/mirror/gm0s3f    496M    4.0K    456M     0%    /var/amavis
/dev/mirror/gm0s3g    496M    1.6M    454M     0%    /var/db
/dev/mirror/gm0s3d    496M    1.8M    454M     0%    /var/qmail
/dev/mirror/gm0s3e    496M    4.0K    456M     0%    /var/virusmails

and

$ gmirror list
Geom name: gm0
State: DEGRADED
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 4081910748
Providers:
1. Name: mirror/gm0
   Mediasize: 160041885184 (149G)
   Sectorsize: 512
   Mode: r12w11e14
Consumers:
1. Name: ad4
   Mediasize: 160041885696 (149G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: DIRTY
   GenID: 0
   SyncID: 1
   ID: 1418281406
2. Name: ad6
   Mediasize: 160041885696 (149G)
   Sectorsize: 512
   Mode: r1w1e1
   State: SYNCHRONIZING
   Priority: 0
   Flags: DIRTY, SYNCHRONIZING
   GenID: 0
   SyncID: 1
   Synchronized: 59%
   ID: 307131166

This system is synchronizing yet.

Paulo Fragoso.



More information about the freebsd-doc mailing list