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

krad kraduk at gmail.com
Sun Oct 23 19:51:21 UTC 2011


On 23 October 2011 10:26, James Coldwell <coldwelljames11 at googlemail.com>wrote:

> 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.
> rth
> 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
> _______________________________________________
> freebsd-fs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
>


I'm curious why did you boot into a linux livecd? Freebsd has a rescue cd,
or you could use pcbsd. Opensolaris or Solars 11 cd would work as well, but
linux??

1st thing to do is calm down as you have made one mistake by destroying one
disk (what if the one you chose was the good one). Boot into a live cd and
DD the remaining zfs disk to a portable drive. You can then play with this
image safely, and or have a backup.

Can you provide any output from the boot process? Get a remote hands
engineer to take a picture. We can then take it from there


More information about the freebsd-fs mailing list