Recover configure from failing boot device

Status
Not open for further replies.

ppmax

Contributor
Joined
May 16, 2012
Messages
111
Hi

I boot from USB (9.3) and am getting a mountroot error because the device is failing. I created a new/fresh boot device but since I was not able to access the gui I couldn't make a backup of my configure.

Is there any was to recover my settings from the old USB boot device? The device mounts, so I should be able to get some data off it.

Thx
PP
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Yes, the config file is here /data/freenas-v1.db ;)
 

ppmax

Contributor
Joined
May 16, 2012
Messages
111
Thanks Bidule0hm--much appreciated.

Since this was an old boot device, how should I mount this thing? I tried Import Disk through the GUI (as NTFS) but that failed.

Since it is a FreeNAS 9.3 device, it appears to have two partitions:
da2p1 (524KB)
da2p2 (8.2GB)

mount -t ??? /dev/da2p2 /mnt/usbOld

I then will copy this over to my local machine and then do a restore through the GUI...

Thx much--
PP
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You said that the device mounts so it shouldn't be a problem to copy the config.

If it's a 9.3 FreeNAS drive then it's a ZFS volume so you should import it. Personally I wouldn't use the GUI for that, but the CLI with zpool import:
  • Use zpool import to see the ID of the pool (you don't want to use the name to mount the pool as it's the same name than the current system pool)
  • Use zpool import -R /mnt the_ID_of_the_pool new_pool_name to import the pool which should be moutned as /mnt/new_pool_name
 
Last edited:

ppmax

Contributor
Joined
May 16, 2012
Messages
111
slaps head...that's right, it's no longer UFS. I've been running around trying to get stuff back online so I'm probably guilty of posting inaccurate information.

I can't boot from this device...I get a mountroot error. Initially I thought this was due to the thread related to setting a boot_delay, but after chasing my tail for a day it turns out the drive appears to be corrupted or failing. Since I haven't been able to boot from it I don't have a backup config handy. I typically create a backup config when upgrading...but I was able to upgrade to 9.3 fine back in December...and I must have tossed my old backup since then (slaps head again).

So to summarize:
I'm on a fresh/new install of 9.3 (using two new mirrored USB drives)
I have an old USB drive with 9.3 on it that won't boot
Running zpool import returns:
Code:
zpool import
   pool: freenas-boot
     id: 12955299643412836894
  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://illumos.org/msg/ZFS-8000-EY
config:

    freenas-boot  ONLINE
      da2p2     ONLINE


da2p2 is the name of the old USB boot device currently plugged in; here's a tail from dmesg:
Code:
ugen1.2: <PNY Technologies> at usbus1
umass2: <PNY Technologies USB 2.0 FD, class 0/0, rev 2.00/11.00, addr 2> on usbus1
umass2:  SCSI over Bulk-Only; quirks = 0x0100
umass2:9:2:-1: Attached to scbus9
da2 at umass-sim2 bus 2 scbus9 target 0 lun 0
da2: <PNY USB 2.0 FD 1100> Removable Direct Access SCSI-4 device
da2: Serial Number ADC7HE03000001344
da2: 40.000MB/s transfers
da2: 7788MB (15950592 512 byte sectors: 255H 63S/T 992C)
da2: quirks=0x2<NO_6_BYTE>


Right now, I don't see an ID for the da2p2 device...am I being totally thick?

thx again for your help--much appreciated!
PP
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Well, I think you might be tired, you can see the ID below? :D
Code:
zpool import
   pool: freenas-boot
     id: 12955299643412836894
   ...


In short use the following command zpool import -f -R /mnt 12955299643412836894 oldboot

Then you should have the pool moutned as /mnt/oldboot so the conf file would be here: /mnt/oldboot/data/freenas-v1.db ;)
 

ppmax

Contributor
Joined
May 16, 2012
Messages
111
I am tired and I appreciate all your replies and help :D

when I do a zpool list I get:
freenas-boot (this is the new dual USB mirrored volume...which I am currently booted from)
volume1 (this is my data pool)

The freenas-boot pool is comprised of drives at:
/dev/da0 (p1 and p2)
/dev/da1 (p1 and p2)

my old USB drive is currently listed at:
/dev/da2 (p1 and p2)

my old USB drive likely has a pool named freeness-boot as well...since i assume this is created by the installer.

when I try running:
zpool import -f -R /mnt 12955299643412836894 oldboot

I get:
cannot import 'freenas-boot' as 'oldboot': one or more devices is currently unavailable

Regarding the output from running zpool import, I interpreted the results such that the ID shown below the pool name referred to the pool named freenas-boot shown directly above...which is already mounted and in use.

I've been reading:
https://forums.freebsd.org/threads/...t-pool-from-fixit-without-importing-it.17560/

What I don't understand is right now, with the old boot device plugged in and seen by the system (da2), how do I get the pool ID from that device?

[Edited original post]
ARGH
I ran dmesg after running the zpool import command you gave me and see this:
Code:
(da2:umass-sim2:2:0:0): WRITE(10). CDB: 2a 00 00 00 06 38 00 00 10 00
(da2:umass-sim2:2:0:0): CAM status: SCSI Status Error
(da2:umass-sim2:2:0:0): SCSI status: Check Condition
(da2:umass-sim2:2:0:0): SCSI sense: DATA PROTECT asc:27,0 (Write protected)
(da2:umass-sim2:2:0:0): Error 13, Unretryable error
(da2:umass-sim2:2:0:0): WRITE(10). CDB: 2a 00 00 00 06 38 00 00 10 00
(da2:umass-sim2:2:0:0): CAM status: SCSI Status Error
(da2:umass-sim2:2:0:0): SCSI status: Check Condition
(da2:umass-sim2:2:0:0): SCSI sense: DATA PROTECT asc:27,0 (Write protected)
(da2:umass-sim2:2:0:0): Error 13, Unretryable error


So it may be that I'm hosed...?

thanks for bearing with me
PP
 

ppmax

Contributor
Joined
May 16, 2012
Messages
111
Incidentally, that is the same sequence of messages I was seeing when trying to boot from that USB stick in the first place...

Would adding the -o readonly option to the command get past this?

thx
PP
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Hmm, doesn't look good at all...

Yes, you can try with the readonly flag but I don't think it'll work unfortunately.

NB: zpool import only lists the unmounted pools so your current freenas-boot pool that is mounted isn't listed, the pool listed is the old one, no problem here ;)
 

ppmax

Contributor
Joined
May 16, 2012
Messages
111
Thanks again for the explanation; i didn't realize zpool import only showed unmounted pools :rolleyes:

Well on the plus side, after running with the readonly flag I see this when running zpool list:
oldboot 7.56G 1.26G 6.30G - 0% 16% 1.00x UNAVAIL /mnt

But ll /mnt doesn't show oldboot.

zpool status -v oldboot:
pool: oldboot
state: UNAVAIL
status: One or more devices has been removed by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
scan: scrub repaired 0 in 0h5m with 0 errors on Tue Feb 3 03:52:58 2015
config:
NAME STATE READ WRITE CKSUM
oldboot UNAVAIL 0 0 0
17333606814086628170 REMOVED 0 0 0 was /dev/da2p2

errors: No known data errors

I tried pool online oldboot 17333606814086628170:
cannot online 17333606814086628170: pool is read-only

So it looks like I may be foobarred...unless you have any other tips?

thx again for all your help and patience :D

PP

PS: one last ditch effort...any way to use dd to find the config file and yank it out that way?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Sorry, but this pool is pretty much dead.

You can try to image the USB drive with dd to try to mount the pool from the image file instead of the drive (the USB controller is maybe ejecting the USB drive because it's in too bad shape when you try to mount the pool) but you certainly can't recover a file directly from a ZFS pool image (as cyberjock says "there is no recovery tool for ZFS").

At least you've not lost your data, only the config. It's annoying but you can always reconfigure the NAS manually.
 

ppmax

Contributor
Joined
May 16, 2012
Messages
111
Yep, moving on...hope to get some of these services restored tonight.

I may try dd'ing the drive to a local file later...

Thanks again for all your help!

PP
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You're welcome ;)
 

justgosh

Dabbler
Joined
May 23, 2013
Messages
11
Personally I wouldn't use the GUI for that, but the CLI with zpool import:
  • Use zpool import to see the ID of the pool (you don't want to use the name to mount the pool as it's the same name than the current system pool)
  • Use zpool import -R /mnt the_ID_of_the_pool new_pool_name to import the pool which should be moutned as /mnt/new_pool_name

Thanks!
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
You're welcome ;)
 

Greg Thomas

Cadet
Joined
Jan 10, 2016
Messages
8
Can you be more explicit on how to mount the old USB flash. My issue is I was not paying attention and my flash got filled with old kernal's and now won't boot. I've tried the zpool import mentioned above zpool import -f -R /mnt 12955299643412836894 oldboot, What I get back is:

cannot import 'freenas-boot' as 'oldboot': one or more devices is currently unavailable.

Any suggestions for a newb who is just learning this (and learning invaluable lessons along the painful way...)
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Well, you need to replace the ID, this one is the one of the OP...

Do the two steps of this post to the letter ;)
 

Greg Thomas

Cadet
Joined
Jan 10, 2016
Messages
8
I realize that, here is my output:

[root@freenas] /# zpool import
pool: freenas-boot
id: 2239956846158377396
state: ONLINE
status: The pool is formatted using a legacy on-disk version.
action: The pool can be imported using its name or numeric identifier, though
some features will not be available without an explicit 'zpool upgrade'.
config:

freenas-boot ONLINE
gptid/fd4130d9-6e16-11e4-b5aa-002264fd66aa ONLINE
[root@freenas] /# zpool import -R /mnt 2239956846158377396 oldusb
cannot import 'freenas-boot': pool may be in use from other system
use '-f' to import anyway
[root@freenas] /# zpool import -f -R /mnt 2239956846158377396 oldusb
cannot import 'freenas-boot' as 'oldusb': one or more devices is currently unavailable
[root@freenas] /#

I also see on the console monitor a few error messages:

(da1:umass-sim1:1:0:0): WRITE(10). CDB: 2a 00 00 00 06 38 00 00 10 00
(da1:umass-sim1:1:0:0): CAM status: SCSI Status Error
(da1:umass-sim1:1:0:0): SCSI status: Check Condition
(da1:umass-sim1:1:0:0): SCSI sense: DATA PROTECT asc:27,0 (Write protected)
(da1:umass-sim1:1:0:0): Error 13, Unretryable error
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
So, either this USB stick is toasted or either it has a write protect button that is enabled.
 

Greg Thomas

Cadet
Joined
Jan 10, 2016
Messages
8
I believe you are correct sir. I decided to give up and rebuild, so I tried to delete the partition and format it and it shows write protected but there is no write protect switch on the drive. Thanks for your help.
 
Status
Not open for further replies.
Top