I'm completely new to ZFS. Today, I did something stupid and caused a problem where I need to recover my entire OS. On a live OS I'm using to recover my machine, I need to mount my ZFS volumes for data transfer. I did the following:
root@kubuntu:/media/kubuntu/backup3-1tb/recovery# zpool import pool: nas-2-mirror id: 11643301469609613604 state: ONLINEstatus: 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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY config: nas-2-mirror ONLINE mirror-0 ONLINE usb-SanDisk_Extreme_55AE_32333135314D343031353938-0:0 ONLINE usb-SanDisk_Extreme_55AE_32333135325A343030313338-0:0 ONLINE pool: nas-1-mirror id: 10379406262813511849 state: ONLINEstatus: 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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY config: nas-1-mirror ONLINE mirror-0 ONLINE usb-SanDisk_Extreme_55AE_32333135314D343031323130-0:0 ONLINE usb-SanDisk_Extreme_55AE_323331363748343030333133-0:0 ONLINEroot@kubuntu:/media/kubuntu/backup3-1tb/recovery# zpool import -f pool: nas-2-mirror id: 11643301469609613604 state: ONLINEstatus: 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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY config: nas-2-mirror ONLINE mirror-0 ONLINE usb-SanDisk_Extreme_55AE_32333135314D343031353938-0:0 ONLINE usb-SanDisk_Extreme_55AE_32333135325A343030313338-0:0 ONLINE pool: nas-1-mirror id: 10379406262813511849 state: ONLINEstatus: 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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY config: nas-1-mirror ONLINE mirror-0 ONLINE usb-SanDisk_Extreme_55AE_32333135314D343031323130-0:0 ONLINE usb-SanDisk_Extreme_55AE_323331363748343030333133-0:0 ONLINEroot@kubuntu:/media/kubuntu/backup3-1tb/recovery# zpool import -f 11643301469609613604 10379406262813511849cannot import '10379406262813511849': name must begin with a letterroot@kubuntu:/media/kubuntu/backup3-1tb/recovery# zpool import -f nas-1-mirror nas-2-mirror <<<==== THIS
Now nas-2-mirror
is fine!
root@kubuntu:~# zpool status pool: nas-2-mirror state: ONLINEconfig: NAME STATE READ WRITE CKSUM nas-2-mirror ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 usb-SanDisk_Extreme_55AE_32333135314D343031323130-0:0 ONLINE 0 0 0 usb-SanDisk_Extreme_55AE_323331363748343030333133-0:0 ONLINE 0 0 0errors: No known data errors
However, nas-1-mirror
is nowhere to be found. I tried to re-import it using its ID:
root@kubuntu:~# zpool import -f 10379406262813511849cannot import '10379406262813511849': a pool with that name already existsuse the form 'zpool import <pool | id> <newpool>' to give it a new nameroot@kubuntu:~# zpool listNAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOTnas-2-mirror 1.81T 40.1G 1.77T - - 0% 2% 1.00x ONLINE -
I thought maybe I borked the name of the volume by importing two volumes at once, so I took the help advice from the import above and tried re-naming the volume
root@kubuntu:~# zpool import -f 10379406262813511849 nas-1-mirrorcannot import '10379406262813511849': no such pool available
I thought maybe I could attempt to just mount it?
root@kubuntu:~# zfs mount nas-1-mirrorcannot open 'nas-1-mirror': dataset does not existroot@kubuntu:~# zfs list -o name,canmount,mountpointNAME CANMOUNT MOUNTPOINTnas-2-mirror on /nas/nas-media
I'm a little concerned. Anyone have anything else I can try?
EDIT
Ah hah! I see what I did. My import renamed the ID to the ID used in the second param in my arguments there.
root@kubuntu:~# zpool list -o guid nas-2-mirror GUID10379406262813511849
So I need to figure out how to undo this.
https://forums.freebsd.org/threads/renaming-zfs-pool-via-zpool-import-mypool-newpoolname.46300/ is relevant (second question), but there is no clear answer on how to fix the problem. I attempted to use zpool import -fa
but I get:
root@kubuntu:~# zpool import -facannot import 'nas-2-mirror': pool already exists
POSSIBLE SOLUTION
I can't try this yet, but maybe: https://illumos.org/books/zfs-admin/gavwn.html
section: 4.1.1. Using Disks in a ZFS Storage Pool
If you inadvertently change both the path and the ID of the device, then export and re-import the pool in order to use it.
When I can, I'll try that suggestion and see where that gets me. I'll post accordingly.
I also see that zfs
exposes a rename
command, so I'll try this too:
zfs rename 10379406262813511849 nas-1-mirror
after I'm done with operation I'm working. I don't want to inadvertently mess with anything.