ZFS How to change a 2-disk mirror pool to unmirrored

Hello,

I have a old desktop machine. There are 2 hard drives attached to it and I've made them mirrored. Now the storage is almost full. Because this machine serves as a non-critical backup, I'm looking to delete the mirror and make good use of the storage. How do I do that?

Thanks.
 
What more do you think needs to be done? You might want to remove the partition table, or completely wipe the drive.
I suppose follow comands would make the deleted hard drive, say ada1, part of existing filesystem:
gpart destroy ada1
gpart create -s gpt ada1
gpart add -t freebsd-zfs ada1
zpool add zroot ada1
zfs create zroot/data
zfs create -o mountpoint=/usr/data zroot/data
 
If you want to add it as a striped volume, that looks good. Just keep in mind that if one of the drives of the striped set fails the entire pool will be gone. Before adding it you might want to have a look at the SMART data (sysutils/smartmontools), just to verify the disk itself is still good enough.
 
Just keep in mind that if one of the drives of the striped set fails the entire pool will be gone.
Good point. It would be safer if the op were to create a completely new pool on the drive being added and then mount the filesystem from that pool on a suitable mountpoint in the original filesystem, e.g. something like this after creating the new partitions on ada1
Code:
zpool create newpool ada1
zfs create -o mountpoint=/usr/data newpool/data
 
I suppose follow comands would make the deleted hard drive, say ada1, part of existing filesystem:
gpart destroy ada1
gpart create -s gpt ada1
gpart add -t freebsd-zfs ada1
zpool add zroot ada1
zfs create zroot/data
zfs create -o mountpoint=/usr/data zroot/data

OK. zpool detach went ok. Then I pretty much ran above commands one by one till zpool add, zpool status shows ada1 is added to zroot. But gpart show doesn't show anything about ada1.
# zpool status
pool: zroot
state: ONLINE
config:

NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
ada0p3 ONLINE 0 0 0
ada1 ONLINE 0 0 0

errors: No known data errors
# gpart show
=> 40 976773088 ada0 GPT (466G)
40 1024 1 freebsd-boot (512K)
1064 984 - free - (492K)
2048 4194304 2 freebsd-swap (2.0G)
4196352 972576768 3 freebsd-zfs (464G)
976773120 8 - free - (4.0K)

dmesg gives me following.
GEOM: ada1: the primary GPT table is corrupt or invalid.
GEOM: ada1: using the secondary instead -- recovery strongly advised.
# gpart recover ada1
gpart: arg0 'ada1': Invalid argument
What am I doing wrong?
 
Good point. It would be safer if the op were to create a completely new pool on the drive being added and then mount the filesystem from that pool on a suitable mountpoint in the original filesystem, e.g. something like this after creating the new partitions on ada1
Code:
zpool create newpool ada1
zfs create -o mountpoint=/usr/data newpool/data
Thanks for the warning.
 
What am I doing wrong?
You added the disk to the pool instead of the partition on that disk, zpool add zroot ada1 vs. zpool add zroot ada1p1. So now the primary partition table got overwritten with ZFS metadata.

Ignore the "error" about the primary partition table being corrupt. Do NOT try to restore it, that will overwrite the ZFS metadata.
 
You added the disk to the pool instead of the partition on that disk, zpool add zroot ada1 vs. zpool add zroot ada1p1. So now the primary partition table got overwritten with ZFS metadata.

Ignore the "error" about the primary partition table being corrupt. Do NOT try to restore it, that will overwrite the ZFS metadata.
Now gpart is not seeing ada1, how do I use its storage then?
 
Myself, I would duplicate the mirror data to a 3rd disk of known good quality.
Then, break the mirror pair entirely, reformat and restore the data.

If your disks are WD or Seagate, there are bootable diagnostic programs that will do a deep analysis of the disk and its electronics.
Devices that more, are devices that break.

Considering the low price of stage media today, my opinion is reusing old disk with high runtime hours, is a mistake that will come back to bite you.
 
Back
Top