- Importing and exporting ZFS pools in a shared-storage high-availability cluster

# Importing and exporting ZFS pools in a shared-storage high-availability cluster

Contents

ZFS file system datasets are always members of a pool, and the pool must be imported to a host before any action can be taken to alter its content. In a shared-storage, high-availability cluster, some pools may be imported on different hosts. This is a common and recommended practice that balances distribution of Lustre OSDs equitably across the HA cluster nodes.

One must always manage ZFS pools and their contents from the host where the pool is imported, but it is easy to overlook and miss ZFS pools that are exported. Use the combined output of zpool list and zpool import to gain a complete list of all storage pools available to a host, and import any pools that require administration.

1. | List the currently imported ZFS pools:

zpool list

2. | If any of the pools that are expected to be on this host are missing, it may be that the pools have been exported, or are imported on a different host. Use the zpool import command to identify these pools. For example:

[root@rh7z-oss1 ~]# zpool import

pool: demo-ost0pool

id: 12622396723776112603

state: ONLINE

action: The pool can be imported using its name or numeric identifier.

config:

demo-ost0pool ONLINE

raidz2-0 ONLINE

sda ONLINE

sdb ONLINE

sdc ONLINE

sdd ONLINE

sde ONLINE

sdf ONLINE

pool: demo-ost1pool

id: 617459513944251623

state: ONLINE

status: The pool was last accessed by another system.

action: The pool can be imported using its name or numeric identifier
and the '-f' flag.

see: http://zfsonlinux.org/msg/ZFS-8000-EY

config:

demo-ost1pool ONLINE

raidz2-0 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0001 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0007 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0011 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0010 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0009 ONLINE

scsi-0QEMU_QEMU_HARDDISK_IEELOST0008 ONLINE

In the example, there are two exported pools. Note that the second pool in the list has a status attribute that is not displayed in the first pool, and that the action attribute indicates that the pool can only be imported by force (indicated by the '-f' flag). This means that the pool has been imported on a different host. Do not import pools that are in this condition unless it can be absolutely determined that the other host is offline or does not have this pool running (this is commonly the case when a server crashes or loses power in an unclean shutdown).

3. | Use the zpool import command, along with the pool name, to import a pool onto the host:

zpool import [-f] <pool name>

For example:

[root@rh7z-oss1 ~]# zpool import demo-ost0pool

A simple approach to managing all of the pools of an HA cluster as a batch, is to export all of the pools from each host connected to common shared storage, and then import all of the pools into a single host, as follows:

1. | Export all of the pools on a host:

zpool export –a

Repeat this on every host in the HA framework

2. | On one host, import all of the zpools:

zpool import -a