May have overwrote my file system by creating a dataset. Need consoling / advice.

Status
Not open for further replies.

cutrock

Cadet
Joined
Sep 2, 2012
Messages
5
Hey all,

I was trying to set up a ZFS data set to house my files and may have shot myself in the foot. I had all my files in a directory titled "mydata", this directory was at the path, "mnt/Primary/mydata". Without thinking everything through, I created a new dataset in my "Primary" ZFS Volume called "mydata" and I'm now unable to access any of my files.

After realizing what I had done, and the possibility of completely screwing myself over if I try to solve this myself, I decided my first course of action should be to consult the experts. My "Primary" volume still shows that it has +/-50gb of my files on it (which is what it had before the snafu), so I'm hopeful that there is a way to regain access to these.

Please, someone tell me that everything will be alright, and if possible, please let me know what my battle strategy should be to move towards recovering my file system. Let me know if there's any further information you need about my configuration.

Thanks!
 

cutrock

Cadet
Joined
Sep 2, 2012
Messages
5
I searched around a little and it seems like this may be pretty catastrophic.

If it helps, I just upgraded my OS from 8.2.0-BETA4 to 8.2 RELEASE and I have a backed up configuration file (the .db file). Would it be possible to revert to 8.2.0-BETA4 and restore my previous settings from this file?

Thanks again!
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Do you have a snapshot from before the change? You could clone it and grab the needed files
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
See [thread=7548]:( Will 'Create ZFS Dataset' delete data? [/thread]. I believe the commands in my post will work. They never reported back though and I never tried it.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
See [thread=7548]:( Will 'Create ZFS Dataset' delete data? [/thread]. I believe the commands in my post will work. They never reported back though and I never tried it.

I tested paleoNs commands back in the other thread. I could have sworn I posted back that all was fine, but I don't have a post after his. I'm like 99% sure all was fine though. It was 3 months ago :P
 

cutrock

Cadet
Joined
Sep 2, 2012
Messages
5
Great news, paleoN! I appreciate the help! My heart has been in my stomach for the past hour or so, and just the possibility of getting my files back is breathing new life into my day. I'm going to hold out for a day or so before I attempt anything just in case someone has some other suggestions.

paleoN's original code for posterity and quick reference:
Code:
zfs unmount /mnt/bigboy/media

ls -al /mnt/bigboy/media

mv /mnt/bigboy/media /mnt/bigboy/temp

mkdir /mnt/bigboy/media

zfs mount bigboy/media

mv /mnt/bigboy/temp/*.* /mnt/bigboy/media


I'm going to rewrite the code here for my own reference and so that people can hopefully catch any mistakes when I use my file structure:
folder: /mnt/Primary/LASTNAME
dataset: /mnt/Primary/LASTNAME
Code:
zfs unmount /mnt/Primary/LASTNAME

ls -al /mnt/Primary/LASTNAME

mv /mnt/Primary/LASTNAME /mnt/Primary/temp

mkdir /mnt/Primary/LASTNAME

zfs mount Primary/LASTNAME

mv /mnt/Primary/temp/*.* /mnt/Primary/LASTNAME


Also, I had a couple questions about the procedure:
  1. Are these all commands that I can execute from the web GUI's shell, or must this be done in the terminal? Is one preferred?
  2. I noticed that all the paths are preceded by /mnt except the one in the 5th line: "zfs mount bigboy/media". Should the /mnt be omitted, or was this a typo?
  3. Would anyone be kind enough to give this a trial run with some fake files before I commit to it with my last 2 years' work?
Finally - just to be clear - there's no way to use the "freenas-FreeNAS-8.2.0-BETA4-x64 (r11722)-20120902163014.db" file that I saved all my config settings to to restore everything? This seems like it would be a preferred option if it contained the settings for my ZFS file system.

Thanks again guys! You've really curbed my fears considerably.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I'm testing this on my VM-machine now.. if you hold on a bit I'll verify this works with no data loss :)
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
It works perfectly :) I'll also post this in the other thread.

Edit: I'm not sure what you are trying to accomplish by restoring your config. Part of the problem is that the dataset is already created. If you restored the config it won't know about the dataset, so you may have issues with FreeNAS not being in sync with the actual system. Just do paleoN's steps and all will be fixed :D
 

cutrock

Cadet
Joined
Sep 2, 2012
Messages
5
Thanks, noobsauce - I appreciate your help. Perhaps tonight I'll attempt the fix.

I wasn't necessarily trying to accomplish anything by restoring the config, just making sure that it wouldn't be a viable option before trying my hand at the big scary terminal.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I noticed that all the paths are preceded by /mnt except the one in the 5th line: "zfs mount bigboy/media". Should the /mnt be omitted, or was this a typo?

Just to clarify the quote, you do NOT need to add the /mnt to that line.

Keep in mind that the commands paleoN gave you will basically dismount your empty dataset, move your data to a temp folder (in your case /mnt/Primary/temp), remount your empty dataset, then move your data from /mnt/Primary/temp into the dataset.

Edit: The commands execute faster than you can type them.. so don't expect this to take more than 2 mins :)
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
paleoN's original code for posterity and quick reference:
:confused: The other thread isn't going anywhere.

I'm going to rewrite the code here for my own reference and so that people can hopefully catch any mistakes when I use my file structure:
Assuming that's actually your file structure it looks fine.

  1. I prefer SSH, but any of them will do.[*]No typos.[*]noobsauce80
While you are waiting maybe you would actually, I don't know, read the man pages for these commands. Then you could understand exactly what they do. It's only your data.

Just to clarify the quote, you do NOT need to add the /mnt to that line.
You can zfs unmount by specifying the mountpoint or the filesystem. Linux has taught me, for Linux at least, to specify the mountpoint, but yes it works either way.

Finally - just to be clear - there's no way to use the "freenas-FreeNAS-8.2.0-BETA4-x64 (r11722)-20120902163014.db" file that I saved all my config settings to to restore everything? This seems like it would be a preferred option if it contained the settings for my ZFS file system.
ZFS datasets are saved in your zpool. Restoring the config won't work because FN8 automatically mounts all the filesystems in a zpool.

Edit: The commands execute faster than you can type them.. so don't expect this to take more than 2 mins :)
It's only the last command that would take any time and that depends on how much data, etc. Speaking of which, you can change it to:
Code:
mv /mnt/Primary/temp/* /mnt/Primary/LASTNAME
 

cutrock

Cadet
Joined
Sep 2, 2012
Messages
5
Thanks, paleoN and noobsauce80

I did everything last night and everything went fairly smoothly - all my files are now in a nice, safe place.
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
Glad it worked out well for you.

Maybe now you will actually have a backup of your files? No form of RAID is any substitute for a proper backup.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
It's always fun when things are rediscovered.

Us old-timer UNIX admins occasionally "hide" things under mountpoints. It's a great trick to keep things out of sight but on a system. This is just the modern ZFS version of that old trick. ;-)
 
Status
Not open for further replies.
Top