Recover deleted volume

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
Hello,

I accidentally deleted the wrong volume.
I haven't done anything after that.
Is there any way to get my data back?

Thanks,
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi Thinker,

That is exactly what backups are for...
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
I was hoping there is a better way. I read something about "zpool import -D" to import destroyed pools. Has anyone experience from that?
 
Joined
Oct 18, 2018
Messages
969
I was hoping there is a better way. I read something about "zpool import -D" to import destroyed pools. Has anyone experience from that?
I did a quick google search and found the following instructions by Oracle. I've never encountered this before but myself so I can't say the likelihood it'll work out for you. If I get time today I may test it myself for fun, I've got a few drives I use to play around with stuff like this in my backup server.
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
I selected export for my volume and ticked all the boxes to destroy the dataset and configuration. After that I saw that I had deleted the wrong volume. :( All the hard drives are now marked as Unused. It would be great if I could just somehow undo it since my backup doesn't have all the latest files and it will take a while to copy.
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
I did a quick google search and found the following instructions by Oracle. I've never encountered this before but myself so I can't say the likelihood it'll work out for you. If I get time today I may test it myself for fun, I've got a few drives I use to play around with stuff like this in my backup server.
It would be great if you could try it. :D I have an old configuration saved also. I am thinking that maybe I could use that also to get my share settings back.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi again Thinker,

my backup doesn't have all the latest files and it will take a while to copy

Good for you that you have backups. At least you have things to recover. Many people do not have backups at all.

If these backups are not up to your expectation, it shows you that your backup plan, despite existing, is not properly satisfying your needs. Once you restored your data, you will have to improve that plan to whatever will satisfy you. Here, I am doing ZFS replication to a second NAS hundreds of KM away, every 15 minutes. These 15 minutes snapshots are kept for a few days and I have many generations, up to monthly snapshots that I save for 4 years. Thanks to that, I have very high precision for a recovery performed quickly after incident, down to good enough considering how long after the incident the recovery is performed.

selected export for my volume and ticked all the boxes to destroy the dataset and configuration.

What FreeNAS version are you running ? Did you do that in the old or new WebUI ?

Also, I am a little confused from your different posts. You said that what you destroyed is the volume and that now the drives are unused. But you also say that it is a dataset that you destroyed. So what exactly was destroyed ? The pool (then of course all the datasets in it suffered the same fate) or only datasets (so the pool itself should have survived) ?
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
Hi again Thinker,



Good for you that you have backups. At least you have things to recover. Many people do not have backups at all.

If these backups are not up to your expectation, it shows you that your backup plan, despite existing, is not properly satisfying your needs. Once you restored your data, you will have to improve that plan to whatever will satisfy you. Here, I am doing ZFS replication to a second NAS hundreds of KM away, every 15 minutes. These 15 minutes snapshots are kept for a few days and I have many generations, up to monthly snapshots that I save for 4 years. Thanks to that, I have very high precision for a recovery performed quickly after incident, down to good enough considering how long after the incident the recovery is performed.



What FreeNAS version are you running ? Did you do that in the old or new WebUI ?

Also, I am a little confused from your different posts. You said that what you destroyed is the volume and that now the drives are unused. But you also say that it is a dataset that you destroyed. So what exactly was destroyed ? The pool (then of course all the datasets in it suffered the same fate) or only datasets (so the pool itself should have survived) ?
Yes, I am behind on my backups. I was planning to do it soon and also go through my files, since I don't think all of them will fit on my backup anymore. I do backups manually since I have the backup unit in the same room and don't want them both to be online at the same time for too long. I know it isn't ideal..

I use FreeNAS-11.2-U5. I use the new GUI.

Yes, I destroyed the volume. Clicked export and ticked all the boxes. Then realized it was the wrong volume.
 
Joined
Oct 18, 2018
Messages
969
Yes, I am behind on my backups. I was planning to do it soon and also go through my files, since I don't think all of them will fit on my backup any more. I do backups manually since I have the backup unit in the same room and don't want them both to be online at the same time for too long. I know it isn't ideal..
I wouldn't beat myself up too much over it. @Heracles' approach is a great one if you can swing having a machine online and accessible somewhere else. I myself keep a backup machine always on and running in my house which receives snapshots via ZFS send/receive from the main server. I then rotate disks in the backup offsite regularly to protect against losing all of my data from fire or theft. Of course the "right" backup strategy depends on you, your budget, your data etc. As always folks on the forums would be happy to help offer advice about backup strategies. There are many posts around too where you can see what current users do.

Yes, I destroyed the volume. Clicked export and ticked all the boxes. Then realized it was the wrong volume.
Ah, I misunderstood above and thought you had destroyed your pool. From what I can tell from searching around it looks like you might be in a tight spot. Hopefully someone will chime in here and tell me I'm wrong and give you some concrete ideas.
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
I wouldn't beat myself up too much over it. @Heracles' approach is a great one if you can swing having a machine online and accessible somewhere else. I myself keep a backup machine always on and running in my house which receives snapshots via ZFS send/receive from the main server. I then rotate disks in the backup offsite regularly to protect against losing all of my data from fire or theft. Of course the "right" backup strategy depends on you, your budget, your data etc. As always folks on the forums would be happy to help offer advice about backup strategies. There are many posts around too where you can see what current users do.


Ah, I misunderstood above and thought you had destroyed your pool. From what I can tell from searching around it looks like you might be in a tight spot. Hopefully someone will chime in here and tell me I'm wrong and give you some concrete ideas.
Yes, my 'tank' pool was destroyed. I think volume and pool is the same thing.
Has anyone tried "zpool import -D" after exporting a pool and ticking all the boxes?
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hi Thinker,

Nope, Pool and Volume are not the same. When you create a pool, by default FreeNAS also creates a volume with the same name. That is why in the old WebUI you saw the name of your pool twice, one under the other. Here, you see the POOL Cloud-DR under which is the VOLUME Cloud-DR. If you keep going, you have the first dataset, DRStore.

As you can understand, this structure is from my DR Server :smile:

Also, I had to do it from the legacy WebUI and I am still looking for that "volume export" you are talking about...
1566148542535.png
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
Learning something new.. :)

I will try to explain what I did..
Go to 'Storage'->'Pools' in the left menu.
Click the wheel symbol and select "Export/Disconnect".
Tick all the boxes and confirm.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Ok; running 11.2u1 and not 5. Here, it is called detach only; no "export".

So that is the screen that pops when you click "detach"

1566149561104.png


So if you did checked all these boxes, you asked for the data to be destroyed (first box). So you explicitly asked for the data to be wiped.

Well... Data are now wiped and so, No, you will not recover them from the drives.

Sorry for you but if indeed that is what you did, your backups will now prove themselves useful even if they are not as complete as you would like...
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
I was hoping there was a way since I haven't done anything after that. I also have an old freenas configuration file. I thought that maybe "zpool import -D" could help me get the data back. Did you try that?
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Unfortunately, I can not try something like that. Both of my FreeNAS are running pools and volumes that I can not risk to loose. I could have do tests with datasets, but no pools or volumes. The DR server is hundreds of Km away and ZFS replication is performed over VPN. Should the pool be corrupted, I would have to either re-sync more than 1 TB over Internet or physically move the server back home to re-sync locally. In both cases, I would end up without protection until the process is over.

From what I found, I think it is safe for you to try the procedure yourself in your actual server. Looks like the command only reads about existing pools and does not modify anything. To double check is surely a safer way to proceed but if you can not, know that should I be in your position, I would do it.

Good luck and do not hesitate to ask others before taking the same bet I said I would take,
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
Heracles, I understand.

Ok, I went to shell and typed "zpool import -D tank".
After that I could see that tank was online using "zpool status", but it was not seen under /mnt.
Then I wrote "zpool export tank".
Then imported tank from the GUI and it seems to be ok.
Now I just need to configure my shares again. I suppose I could just use an old config file, right?
 
Joined
Oct 18, 2018
Messages
969
Now I just need to configure my shares again. I suppose I could just use an old config file, right?
If you were able to import it using the GUI that is a good sign. You can try to import your old config file now if you wish. Before you do that I suggest that you back up the current config just in case. Keep in mind that the config is not the worst thing to have to redo in most cases. If you don't like the config as-is you can always go through and reconfigure your shares etc.

It sounds like in fact you did export and "delete" your old pool. I only put delete in quotes because selecting the "Destroy data on this pool?" box is not the same as running dd 7 times over your drive and thus zpool import -D worked. Happy you got your pool back! :)
 

thinker

Dabbler
Joined
Aug 18, 2019
Messages
13
Wohoo, the old config seems to work for tank. Now I just need to sort out a small problem with the other pool that I don't care about. I am glad I didn't fiddle with the backup since this was much quicker and now I seem to have all the data. :D
 
Top