Can ZFS mirror a single disk pool automatically? [closed]
I'm getting ready to add another server to my home network. I currently have one storage drive for it. I want to add another one to mirror the first drive, but can't purchase the second drive for a couple of weeks to a month. I want to use ZFS on the mirrored storage drives. Can I start copying data to my single storage drive, later add the second drive, and have ZFS copy the first drive's data to the second drive in a mirror?
Yes, adding a second drive to mirror an existing vdev is pretty easy.
Lets say you created your pool like this. I use GPT partition labels like zfs-d1 to make the names nice/reliable.
zpool create zfs1 -o ashift=12 -m none /dev/disk/by-partlabel/zfs-d1
pool: zfs1
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zfs1 ONLINE 0 0 0
zfs-d1 ONLINE 0 0 0
Adding another drive to the be a mirror for zfs-d1 is easy. We are going to give the new one the label zfs-d2
zpool attach zfs1 /dev/disk/by-partlabel/zfs-d1 /dev/disk/by-partlabel/zfs-d2
Which I believe should result in a pool that looks like this. You would need to wait a while for things to resync, but you really don't have to do much.
pool: zfs1
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zfs1 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
zfs-d1 ONLINE 0 0 0
zfs-d2 ONLINE 0 0 0
Anyway I strongly suggest you try this in a VM really quick. Build up a VM add a few small virtual disk and just try adding them to a pool. Testing in a VM will let you have a place to try things out, and if you screw up you lose nothing.