2007年11月04日(日)


gmirror

PC :

Make Live CD dependent to your release.
Recent FreeBSD CD2 is not an Live CD. Get CD1.
 # fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/6.1/6.1-RELEASE-i386-disc1.iso
 # burncd -f /dev/acd0 data 6.1-RELEASE-i386-disc1.iso fixate

Make sure what dev's are to be gmirror'ed.
 % grep 'kernel: ad' /var/log/messages
 Nov  4 11:10:30 kuro kernel: ad4: 76319MB <Seagate ST380817AS 3.42> at ata2-master SATA150
 Nov  4 11:10:30 kuro kernel: ad6: 157066MB <Hitachi HDS721616PLA380 P22OABEA> at ata3-master SATA150

Reboot with Live CD.
 Change BIOS or some to boot CD.
 After boot, start fixit.
 # chroot /dist
 # mount_devfs devfs /dev
 # gmirror load
 # gmirror label -v -b split m0 /dev/ad4
 # mount /dev/mirror/m0s1a /mnt
 # echo 'geom_mirror_load="YES"' >> /mnt/boot/loader.conf
 # echo 'swapoff="YES"' >> /mnt/etc/rc.conf
 # sed "s%ad4%mirror/m0%" /mnt/etc/fstab > /mnt/etc/fstab.new
 # mv /mnt/etc/fstab /mnt/etc/fstab.orig
 # mv /mnt/etc/fstab.new /mnt/etc/fstab
 # exit
 Cf. http://www.karashi.org/~poppen/d/20051118.html#p05

Shutdown, connect ad6 and boot on multi user mode.
 # fdisk -i -1 ad6
 # bsdlabel -w ad6

Begin building mirror.
 # gmirror insert -v m0 ad6
   Done.
 # gmirror status
       Name    Status  Components
  mirror/m0  DEGRADED  ad4
                       ad6 (0%)

 Nov  4 11:10:30 kuro kernel: GEOM_MIRROR: Device m0: provider ad4 detected.
 Nov  4 11:10:30 kuro kernel: GEOM_MIRROR: Device m0: provider ad4 activated.
 Nov  4 11:10:30 kuro kernel: GEOM_MIRROR: Device m0: provider mirror/m0 launched.
 Nov  4 11:28:41 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 detected.
 Nov  4 11:28:41 kuro kernel: GEOM_MIRROR: Device m0: rebuilding provider ad6.
 Nov  4 11:58:25 kuro kernel: GEOM_MIRROR: Device m0: rebuilding provider ad6 finished.
 Nov  4 11:58:25 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 activated.


* Disable disk once marked if named by mistaken.
  # gmirror deactivate marked_name ad6s1a

If not recognised ad4?
After shutdown, power-off ad4 and start.
 Boot up from ad6 automatically with some errors, not fatal.

 Nov  4 12:22:00 kuro kernel: GEOM_MIRROR: Device m0 created (id=3510722158).
 Nov  4 12:22:00 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 detected.
 Nov  4 12:22:00 kuro kernel: GEOM_MIRROR: Force device m0 start due to timeout.
 Nov  4 12:22:00 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 activated.
 Nov  4 12:22:00 kuro kernel: GEOM_MIRROR: Device m0: provider mirror/m0 launched.

Works without problems.

Restore.
Shutdown again and power-on ad4 and start.
 BIOS should be set ad4 first-boot.
 Boot up without any errors and any seeking noise,
  because booting from ad6 that's newer than ad4.
 And starts mirroring ad6 to ad4 from the top to the bottom automatically.
  This is a rebuilding.

 # gmirror list
 Geom name: m0
 State: DEGRADED
 Components: 2
 Balance: split
 Slice: 4096
 Flags: NONE
 GenID: 0
 SyncID: 2
 ID: 3510722158
 Providers:
 1. Name: mirror/m0
    Mediasize: 80026361344 (75G)
    Sectorsize: 512
    Mode: r8w7e8
 Consumers:
 1. Name: ad4
    Mediasize: 80026361856 (75G)
    Sectorsize: 512
    Mode: r1w1e1
    State: SYNCHRONIZING
    Priority: 0
    Flags: DIRTY, SYNCHRONIZING
    GenID: 0
    SyncID: 2
    Synchronized: 19%
    ID: 1330449739
 2. Name: ad6
    Mediasize: 164696555520 (153G)
    Sectorsize: 512
    Mode: r1w1e1
    State: ACTIVE
    Priority: 0
    Flags: DIRTY
    GenID: 0
    SyncID: 2
    ID: 3834783892

 # gmirror status
      Name    Status  Components
 mirror/m0  DEGRADED  ad4 (20%)
                      ad6

 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0 created (id=3510722158).
 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0: provider ad4 detected.
 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 detected.
 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0: provider ad6 activated.
 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0: provider mirror/m0 launched.
 Nov  4 12:26:52 kuro kernel: GEOM_MIRROR: Device m0: rebuilding provider ad4.
 Nov  4 13:00:04 kuro kernel: GEOM_MIRROR: Device m0: rebuilding provider ad4 finished.
 Nov  4 13:00:04 kuro kernel: GEOM_MIRROR: Device m0: provider ad4 activated.


See the slices of the latter added HDD?
 # gmirror status
     Name    Status  Components
 mirror/m0  COMPLETE  ad4
                      ad6
Cannot see each HDDs before removing.
 # gmirror remove ad6
 Too few arguments.
 # gmirror remove m0 ad6
 # bsdlabel ad6
 bsdlabel: /dev/ad6: no valid label found
 # bsdlabel ad6s1
 # /dev/ad6s1:
 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a:  1048576        0    4.2BSD        0     0     0
   b:  3880592  1048576      swap
   c: 156296322        0    unused        0     0         # "raw" part, don't edit
   d:  4036608  4929168    4.2BSD        0     0     0
   e:  1048576  8965776    4.2BSD        0     0     0
   f: 41943040 10014352    4.2BSD        0     0     0
   g:  4194304 51957392    4.2BSD     2048 16384 28552
   h: 100144626 56151696    4.2BSD     2048 16384 28552
See the first attatched HDD also.
 # bsdlabel ad4s1
 bsdlabel: /dev/ad4s1: No such file or directory
 # bsdlabel mirror/m0s1
 # /dev/mirror/m0s1:
 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a:  1048576        0    4.2BSD        0     0     0
   b:  3880592  1048576      swap
   c: 156296322        0    unused        0     0         # "raw" part, don't edit
   d:  4036608  4929168    4.2BSD        0     0     0
   e:  1048576  8965776    4.2BSD        0     0     0
   f: 41943040 10014352    4.2BSD        0     0     0
   g:  4194304 51957392    4.2BSD     2048 16384 28552
   h: 100144626 56151696    4.2BSD     2048 16384 28552
They are just the same despite the sizes are different from
 each other, not shown here.
Restore the latter added HDD to gmirror.
 # gmirror insert ad6
 Too few arguments.
 # gmirror insert m0 ad6
 # gmirror status
      Name    Status  Components
 mirror/m0  DEGRADED  ad4
                      ad6 (0%)
 #
Starts rebuilding as if this is the first time added.


generated by makediary-2.11