How should I import a pool withe name collision

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

How should I import a pool withe name collision

Postby Sigmoid » Fri Mar 10, 2017 12:12 pm

So I've been using zfs for quite a long time, but I guess I have to ask a real n00b question... I have a hard drive from an unbootable computer that I need to save stuff off of. The problem is that the home folder on this drive is on a zpool named the same as the home zpool on my working computer.

What I really need to avoid is jeopardizing the current home zpool due to some weird name collision bugs. Is there a best practice how I should do this?
Sigmoid
 
Posts: 12
Joined: Thu May 01, 2014 10:18 am

Re: How should I import a pool withe name collision

Postby stumble » Fri Mar 10, 2017 3:10 pm

From the zpool man page:

Code: Select all
zpool import [-o mntopts] [ -o property=value] ... [-d dir | -c cachefile] [-D] [-f] [-m] [-R root] [-F [-n]] [-t]] pool | id [newpool]


Imports a specific pool. A pool can be identified by its name or the numeric identifier. If newpool is specified, the pool is imported using the name newpool.


In other words, you can do

Code: Select all
sudo zpool import current-name new-name


I hope you manage to save all your data.
stumble
 
Posts: 37
Joined: Thu May 15, 2014 7:05 pm

Re: How should I import a pool withe name collision

Postby nodarkthings » Fri Mar 10, 2017 4:53 pm

I had that issue a few days ago! ;)
if you type:
Code: Select all
sudo zpool import

Your pools available for import display, for example:
Code: Select all
 pool: Videos
     id: 8113368756740840795
  state: ONLINE
 action: The pool can be imported using its name or numeric identifier.

Copy the id and type (in this example):
Code: Select all
sudo zpool import 8113368756740840795


It was useful in my case because, while tinkering, I defined twice the same name for overlapping pools.
Perhaps, in your case, you'd have to export your working pool first, if the solution given by stumble fails.
I've just tested another option combining both solutions, using the id and a new name (say Films):
Code: Select all
sudo zpool import 8113368756740840795 Films

It takes more time to mount but it works! :)
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 8 guests