Recover Config.db via SSH?

Status
Not open for further replies.

Norlig

Explorer
Joined
Jul 13, 2013
Messages
59
Hi,

I have a failed USB-Drive, received following Emails:

starting scrub of pool 'freenas-boot'
-----------------
The boot volume state is ONLINE: One or more devices are faulted in response to IO failures.
-----------------
cannot open 'freenas-boot/ROOT': pool I/O is currently suspended
-----------------|

Google results led me to that my USB pen drive which I boot from, has failed.

@ work at the moment, so havent tried alot yet, but I plan to buy two new USB pen drive's and install Frenas on these, mirroring them.

What I was wondering, is it possibly to recover the config.xml file via SSH in putty?

The WebUI Doesnt load, but I can login via SSH.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It's been a long time (i.e., since the 0.7 days) since the config file was XML, but if you can SSH to the server, you can find it at /data/freenas-v1.db. Copy it to an accessible share and you're good. Or scp it, or ftp it, somewhere you can get to it.

If you've implemented some kind of backup script for your config database, you can find your backups wherever you've set the script to store them (and if you haven't done so, it'd be a good idea to start).
 

Norlig

Explorer
Joined
Jul 13, 2013
Messages
59
It's been a long time (i.e., since the 0.7 days) since the config file was XML, but if you can SSH to the server, you can find it at /data/freenas-v1.db. Copy it to an accessible share and you're good. Or scp it, or ftp it, somewhere you can get to it.

If you've implemented some kind of backup script for your config database, you can find your backups wherever you've set the script to store them (and if you haven't done so, it'd be a good idea to start).

Sorry, read somewhere it was an .xml file.

What exactly do I have to type to scp it? (I Use Putty)
WinSCP gets stuck on "starting the session.."

never done it before, I am very novice at BSD commands.


My freenas is very basic set up, first issue like this.
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It's been a long time since I used PuTTY, and I use a Mac, so I'm afraid I can't help you there. On my Mac, the command that works is 'scp root@freenas:/data/freenas-v1.db .', where the . represents the current directory and could be changed to any local directory. The same command should work on any *nix-based machine.

Do you have an accessible share on the server? If so, the easiest thing to do is probably just to copy the config file there. SSH to the server, 'cp /data/freenas-v1.db /path/to/share/', and then copy it from the share onto a client computer.

You get a gold star for recognizing that you're using BSD, not Linux.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
For now, since you can log in via SSH, I suggest that you merely copy the config DB over to your pool. For example, if the pool is "tank", copy it: "cp /data/freenas-v1.db /mnt/tank/freenas-v1.db"

This involves very few bits on the failing device, so that's the most likely path to success. Once you do that, then you can try various things to retrieve it from the system, but either way you've got that precious copy of the config. :smile:
 

Norlig

Explorer
Joined
Jul 13, 2013
Messages
59
It's been a long time since I used PuTTY, and I use a Mac, so I'm afraid I can't help you there. On my Mac, the command that works is 'scp root@freenas:/data/freenas-v1.db .', where the . represents the current directory and could be changed to any local directory. The same command should work on any *nix-based machine.

Do you have an accessible share on the server? If so, the easiest thing to do is probably just to copy the config file there. SSH to the server, 'cp /data/freenas-v1.db /path/to/share/', and then copy it from the share onto a client computer.

You get a gold star for recognizing that you're using BSD, not Linux.

That did it :)

Rebooted my Freenas after getting the file, and it actually booted in, granted it took quite a while longer, seemed like it repaired some stuff while booting.
Now boot device shows as healthy

I have attached another USB device and plan on mirroring them, but I cannot seelct it when I want to attach a member disk:
20151002155907-82962523.png


Does it have to be a specific format, or do I have to activate it to be able to select it?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
So there's nothing in the dropdown when you try to drop it down. What do you see if you go to the console and try "camcontrol devlist"?
 

Norlig

Explorer
Joined
Jul 13, 2013
Messages
59
So there's nothing in the dropdown when you try to drop it down. What do you see if you go to the console and try "camcontrol devlist"?

It was not listed there

%Cough%

Plugged the other USB Stick out of the USB 3.0 port, and into a USB 2.0 port.

Then it was listed and I could select it as a member disk. :)
 

Norlig

Explorer
Joined
Jul 13, 2013
Messages
59
I got this Log:


The mirror appears to have been set up, though.

Does the log show anything erroneous?
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Without looking at the code, that kinda looks like a code error. I'd suggest filing a bug report and include a link to this thread.
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
Status
Not open for further replies.
Top