zpool import by UUID?

3,791 views
Skip to first unread message

David Abrahams

unread,
Sep 25, 2008, 2:32:31 PM9/25/08
to zfs-...@googlegroups.com

Hi,

I made the mistake of creating a pool of disks using letter names
(e.g. /dev/sda, /dev/sdb...), and then I plugged in an external disk
before boot. Of course it conveniently occupied /dev/sda and shifted
all my zfs disks over, so alright, I did a zpool export and a zpool import
and everything was recovered. Great, except I wish I'd created the pool
using devices named in /dev/disk/by-uuid instead. So I tried

zpool export olympic
zpool import -d /dev/disk/by-uuid olympic

and... nothing. Also,

zpool import -d /dev/disk/by-uuid

still nothing. Is there any way to get this pool to use the UUID names,
or do I have to start over from scratch?

Thanks,

--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

drewpca

unread,
Sep 25, 2008, 3:33:22 PM9/25/08
to zfs-fuse

> and everything was recovered.  Great, except I wish I'd created the pool
> using devices named in /dev/disk/by-uuid instead.  So I tried
>
>   zpool export olympic
>   zpool import -d /dev/disk/by-uuid olympic
>

Alas, zfs-fuse turns alternate names back into the 'sda' device names
after your first export/import. I was trying to use /dev/disk/by-id
instead of by-uuid, but I imagine you'll see the same thing.

On the bright side, I haven't had any issues with device names
shifting around. ZFS seems to always figure out which disks belong in
which pool positions. I just have to do some extra dereferencing of
'sda' names when I'm debugging things.



Incidentally, I made the mistake of using sdf1 as the first disk in a
mirror my first time.

# zpool attach stor2 sdf1 /dev/disk/by-id/ata-Maxtor_7H500F0_H81E75AH
cannot attach /dev/disk/by-id/ata-Maxtor_7H500F0_H81E75AH to sdf1: no
such device in pool

I eventually migrated everything to a whole disk (sdg instead of sdg1)
and then rebuilt the mirror with 'sdf'. For the migration I had to use
rsync, since send/receive would stall and require a zfs restart. Maybe
this is because zfs-fuse doesn't support two zfs commands running at
once (aka "zfs send x | zfs receive y")? Anyway, the snapshots that I
lost were not important, and now things have been smooth for 10+ days.

Ricardo M. Correia

unread,
Sep 26, 2008, 10:31:45 AM9/26/08
to zfs-...@googlegroups.com
Hi David,

On Qui, 2008-09-25 at 14:32 -0400, David Abrahams wrote:
>
> Hi,
>
> I made the mistake of creating a pool of disks using letter names
> (e.g. /dev/sda, /dev/sdb...), and then I plugged in an external disk
> before boot. Of course it conveniently occupied /dev/sda and shifted
> all my zfs disks over, so alright, I did a zpool export and a zpool import
> and everything was recovered. Great, except I wish I'd created the pool
> using devices named in /dev/disk/by-uuid instead.

Why would you want to use /dev/disk/by-uuid as opposed
to /dev/disk/by-id?

> So I tried
>
> zpool export olympic
> zpool import -d /dev/disk/by-uuid olympic
>
> and... nothing. Also,
>
> zpool import -d /dev/disk/by-uuid
>
> still nothing. Is there any way to get this pool to use the UUID names,
> or do I have to start over from scratch?

Currently, there isn't, because ZFS devices are not put
into /dev/disk/by-uuid.

I think (but I'm not sure) that libvolume_id in udev is responsible for
extracting the UUIDs that go into /dev/disk/by-uuid, but obviously it
doesn't know about ZFS yet.

Perhaps using "zpool import -d /dev/disk/by-id" would do what you want?

Cheers,
Ricardo


Ricardo M. Correia

unread,
Sep 26, 2008, 10:37:35 AM9/26/08
to zfs-...@googlegroups.com
On Qui, 2008-09-25 at 12:33 -0700, drewpca wrote:
> Alas, zfs-fuse turns alternate names back into the 'sda' device names
> after your first export/import.

That's because by default zfs-fuse only searches for disks in /dev (it
doesn't go into subdirectories).

The reason for this default is that /dev/disk/by-id is not available
everywhere, although I guess I could implement some kind of
autodetection.

If you want to get your alternate names back, you can use "zpool import
-d /dev/disk/by-id".

> I was trying to use /dev/disk/by-id
> instead of by-uuid, but I imagine you'll see the same thing.
>
> On the bright side, I haven't had any issues with device names
> shifting around. ZFS seems to always figure out which disks belong in
> which pool positions. I just have to do some extra dereferencing of
> 'sda' names when I'm debugging things.

Good to hear :)

Cheers,
Ricardo


Rudd-O

unread,
Oct 3, 2008, 8:59:03 AM10/3/08
to zfs-fuse
Oh yeah, I also discovered by accident that you can't run zfs send and
zfs receive in the same machine. It stalls because only one zfs
command may be running at any point.

Chris Samuel

unread,
Nov 8, 2008, 8:19:39 PM11/8/08
to zfs-...@googlegroups.com

That's odd, it certainly used to work as I used it to move data between
different ZFS pools on this machine..

--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC

This email may come with a PGP signature as a file. Do not panic.
For more info see: http://en.wikipedia.org/wiki/OpenPGP

signature.asc
Reply all
Reply to author
Forward
0 new messages