I was unlucky enough to have one of the disks in my five-disk zpool destroyed by accident. I bought a new blank disk to replace it. But I could not get the zpool replace command to work. Now I cannot import the pool. But I believe that if I can recreate the label on the missing disk I can manage to import and resilver the missing disk. I know the GUID of the missing disk. Here is a script I wrote to emulate the exact situation I have. A zpool with one disk destroyed and knowing the disk GUID:
How can I bring my zpool up to a working condition?
Eskil...

Code:
#!/bin/sh
set -vx
# Just in case zpool trouble was imported, export it.
zpool export trouble
# Directory for disk files
dir=/tmp
# Make 5 disk files with minimum size for a zpool. 64M
for num in $(seq 1 5)
do
dd if=/dev/zero bs=1048576 count=64 of=$dir/disk$num
done
# Create a zpool with name=trouble
zpool create trouble $dir/disk1 $dir/disk2 $dir/disk3 $dir/disk4 $dir/disk5
# Create a filesystem in the trouble zpool
zfs create trouble/files
# Put a file in the filesystem
echo Trouble arises when a disk is destroyed >/trouble/files/truth.txt
# export trouble zpool
zpool export trouble
# get the guid of the first disk before we destroy it
zdb -l $dir/disk1 | grep -v _guid: | grep guid: | head -1
# Now, destroy the first disk.
dd if=/dev/zero bs=1048576 count=64 of=$dir/disk1
# This fails. Miserably
zpool import -d $dir trouble
zpool import -d $dir
How can I bring my zpool up to a working condition?
Eskil...
