Restore a ZFS mirror setup (GPT, ZFS-on-root)

James Coldwell coldwelljames11 at googlemail.com
Sun Oct 23 09:49:00 UTC 2011


Hello List,

My Problem:
My server wouldn't come back up after a reboot.
It is a 8.2-RELEASE system, running a two-disk ZFS mirror setup.
It is a dedicated box in a remote datacenter.
I can boot up some linux-based rescue system.

The way I installed FreeBSD on it was with mfsbsd, the zpool was
created as such:
    set poolname="z0"
    set dev1="ad4"
    set dev2="ad6"
    set swapsize="4G"
    set zfssize="300G"
    gpart delete -i 1 ${dev1}
    gpart delete -i 1 ${dev2}
    gpart destroy ${dev1}
    gpart destroy ${dev2}
    gpart create -s gpt ${dev1}
    gpart create -s gpt ${dev2}
    gpart add -b 34 -s 64k -t freebsd-boot ${dev1}
    gpart add -s ${swapsize} -t freebsd-swap -l swap0 ${dev1}
    gpart add -s ${zfssize} -t freebsd-zfs -l disk0 ${dev1}
    gpart add -b 34 -s 64k -t freebsd-boot ${dev2}
    gpart add -s ${swapsize} -t freebsd-swap -l swap1 ${dev2}
    gpart add -s ${zfssize} -t freebsd-zfs -l disk1 ${dev2}
    gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${dev1}
    gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${dev2}
    zpool create ${poolname} mirror /dev/gpt/disk0 /dev/gpt/disk1

That worked perfectly for half a year.
Suddenly, it wouldn't come back up after a reboot.

What I want to do now is mount the filesystem and check for misconfiguration.
So I once again booted into the linux-based rescue system, dd'd mfsbsd
onto the first disk (/dev/sda), booted it up.
This FreeBSD-based system is called "prealpha".
That's where I am now:
    prealpha# gpart show
    =>        0  976773168  ada0  BSD  (466G)
              0         16        - free -  (8.0K)
             16      65520     1  !0  (32M)
          65536  976707632        - free -  (466G)

    =>       34  976773101  ada1  GPT  (466G)
             34        128     1  freebsd-boot  (64K)
            162    8388608     2  freebsd-swap  (4.0G)
        8388770  629145600     3  freebsd-zfs  (300G)
      637534370  339238765        - free -  (162G)
    prealpha# ls /dev/gpt/
    disk1    swap1
The devices changed name from ad4/ad6 to ada0/ada1 because mfsbsd
loads the ahci module now.
I want to mount the zpool from ada1, and view/edit some configuration files.
After that, I want to restore the mirror setup with ada0 and ada1 and
try to boot again.

How do I do that?
Any help would be appreciated, I probably forgot to mention vital
details, I am in a bit of a panic right now.
Please tell me if you need for details.

James


More information about the freebsd-fs mailing list