SPARC to x86 migration using OpenZFS
Tags: zfs, openzfs, linux, sparc
Published: 2022-08-13 07:07:46

If you have ever run a database on a SPARC platform, the very thought of migrating it to an x86 based system can be mind numbing. Different architectures, endianness, operating systems and what not. A Solaris SPARC system doesn’t support the native Linux file systems such as ext4, xfs etc, which makes any migration even more difficult.

Fortunately, there’s now a common ground between two platforms through the implementation of ZFS file system for Linux. The ZFS file system can be exported from one system to another, even if the two systems have different architectural endianness. This allows it to be used as a bridge for migrating from SPARC to x86.
Setup

The below steps were performed on Solaris SPARC 11.4 and RHEL 7.9. You can install OpenZFS on RHEL by following this link. The steps in this demo can be broken down as follows:

1- Connect a disk to Solaris SPARC host

2- Create a ZFS pool and file system on the disk

3- Disconnect and remove the disk from the Solaris host

4- Connect the disk to the RHEL host

5- Import the ZFS file system

**ZFS pool and file system versions**

Check the current ZFS and pool versions on the Solaris SPARC platforms.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zbp979pvouqjit4xf6x5.png)

Check the same on RHEL host.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11jjxxd93890q11tk2tv.png)

We can see that the ZFS file system and pool versions on Solaris SPARC system are 6 and 47 respectively. This is important to note. There are different ZFS file system and pool versions available, having different features. On Solaris, these versions are shown by incrementing version numbers (1,2,3 etc). The OpenZFS project for Linux uses feature flags to show these different version numbers. This causes confusion as the exact version number on Solaris based ZFS cannot be cross matched with the feature flags on OpenZFS.

By default, the creation of a ZFS pool on Solaris is done using the latest available version, which is not compatible with Open ZFS on Linux. To work around this, the ZFS pool on Solaris needs to created by specifying a version, which can be imported on Linux. ZFS on Linux includes support for legacy ZFS pool versions 1–28.

**Create a ZFS pool and file system**

Create a ZFS pool and file system on the Solaris SPARC system. Use version 28 for the pool and version 5 for the file system.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijm09oqli3m8s6zek0d6.png)

Once the file system has been created, you can place some dummy data inside it so that it can be verified once the same file system is mounted on the Linux host. Safely un-mount the ZFS file systems, and export the pool, so that it can be imported on the RHEL system later.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggwny2lrp6hq35gedc9l.png)

**Import ZFS on Linux**

Now, disconnect the disk (on which ZFS was created) from Solaris host and connect it to the RHEL system. Run the import command and see if the pool is online.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4mme2lfy7gl6z7cxdma.png)

The status shows that “the pool was last accessed by another system”. Although the pool is online, it’s still not showing up in the “zpool list” output. If that’s the case, try importing the pool forcefully, it might throw up a few warnings on some systems, but they can be ignored.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4i570r8ztxmc139xet0.png)

The ZFS file systems get mounted automatically once the pool has been successfully imported. ZFS also logs any commands that change the pool configuration. You can check what commands were run to create this pool. How cool is that!


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcghruxe2rv6suhhxlgr.png)