I’m a huge fan of ZFS because of its performance and other features like snapshots, transparent compression. In fact I had switched to FreeBSD for servers just because it had native ZFS support. But as of Ubuntu 16.04, ZFS is officially supported for non-root partitions.
Now I’m migrating a FreeBSD server to Ubuntu 16.04 with ZFS for data storage – this is happening because I need support for some special hardware which has drivers only for Linux and I do not have a spare server machine of same capacity in terms of memory/disk/processor.
My case –
Here’s the zpool layout on my existing FreeBSD server:
zroot ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-1 ONLINE 0 0 0 diskid/DISK-2 ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 diskid/DISK-3 ONLINE 0 0 0 diskid/DISK-4 ONLINE 0 0 0
Each of those disks are 1TB in size and the layout here is something known as RAID 10, or striped mirroring. Striped mirroring can be extended to more than four disks but in my case, I have two pairs of disks. Each pair is mirrored and the each such mirror is striped, illustrated as in the image below:
The advantage of this layout is that you get read speed of four disks, and write speed of two disks and a failure tolerance of two disks (but in different mirrors) at the same time.
I have a spare 1TB disk which I can use for preparing a new server using a low-end machine for migration. I remove one of the disks from the live server so the pool there runs in a degraded state. The removed disk is used in the new server. So I create this zpool in Ubuntu:
zpool create zdata /dev/disk/by-id/disk1-part3 /dev/disk/by-id/disk2-part3 zpool status zdata ONLINE 0 0 0 disk1-part3 ONLINE 0 0 0 disk2-part3 ONLINE 0 0 0
The pool created here is a plain simple stripe. To convert this into a striped-mirror, the zpool attach command has to be used:
zpool attach zdata disk1-part3 disk3-part3 zpool attach zdata disk2-part3 disk4-part3
With this, the pool now becomes a striped mirror:
zdata ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 disk1-part3 ONLINE 0 0 0 disk3-part3 ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 disk2-part3 ONLINE 0 0 0 disk4-part3 ONLINE 0 0 0
Perfect! 😀
The post ZFS convert stripe to striped-mirror appeared first on Nilesh.