If you use ZFS as the file system, you probably already know that tank
is the most common name for ZFS pools. That also applies to me, I do name most of my ZFS pools as tank
as the default. There is no issue with that name, however, since ZFS’s pool name must be unique, this means I couldn’t import or have multiple ZFS pools with the name tank
on a system.
So what can we do if we need to import 2 ZFS pools for some reasons? Well, we can temporarily name the additional pools with different names.
The following will demonstrate how can this be done on a live XCP-NG server.
First, list the current imported ZFS pool on the server, named tank
, of course, running on /dev/sda
device.
[18:51 xcpng ~]# zpool status
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
sda ONLINE 0 0 0
errors: No known data errors
Next, list the available pool to be imported.
[18:51 xcpng ~]# zpool import
pool: tank
id: 17451229533051529435
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
tank ONLINE
sdc ONLINE
For fun, let’s try to import the second tank
pool on the /dev/sdc
device.
[18:52 xcpng ~]# zpool import tank
cannot import 'tank': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name
Well, we already knew that, didn’t we? The output of the command also suggested to imported the pool as a new name. That would work, but I want to keep the pool name as tank
after I exported this device.
At this stage, we can decide to import the tank
pool on /dev/sdc
as temporary name tanktemp
. Here is how we can do this.
[18:56 xcpng ~]# zpool import 17451229533051529435 -t tanktemp
[18:56 xcpng ~]# zpool status
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
sda ONLINE 0 0 0
errors: No known data errors
pool: tanktemp
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tanktemp ONLINE 0 0 0
sdc ONLINE 0 0 0
errors: No known data errors
That’s it. The additional tank
pool has been successfully imported it to a temporary name tanktemp
with the -t
option.