How to dump / restore entire Dataset

Status
Not open for further replies.

Hans Baumeister

Dabbler
Joined
Feb 20, 2014
Messages
23
Hi, I set up a RAIDZ1 on three 3GB drives (on 9.2.2) last week, not realizing that you couldn't expand the dataset of a RAIDZ1 after creating it (at least not with one drive). Now that I've RTFM, I realize that in order to add the 4th drive, I'll need to re-do the dataset.

I've already copied quite a bit of data onto it and set up ownCloud in a jail. Sure, I can re-do all of that, but perhaps there is an easier way? Being the Noob that I am, I'm thinking along the lines of dumping (dd?) the entire ZFS dataset onto an externally attached drive, then re-creating the dataset with 4 drives and dumping the ZFS dataset back onto the FreeNAS.

Is something like that possible? I've tried to find an answer to that but so far no luck.

Thanks!
 

Sir.Robin

Guru
Joined
Apr 14, 2012
Messages
554
You want to recreate the volume wich the Dataset resides on.

That said, yes, you can do what you are asking.

I did this myself, although not with an external HDD. I used 4 drives and created a temp raidz2.

Stop any services using the dataset.
Crate a snapshot of your dataset.
Create a temp volume on secondary drive(s) then replicate your dataset to this.
Destroy and recreate the volume on your primary drives.
Then replicate the dataset back.

Code:
zfs send volume/dataset@snap1 | zfs recv tempvolume/dataset
 

Hans Baumeister

Dabbler
Joined
Feb 20, 2014
Messages
23
Cool, thanks Sir Robin; my additional Disk should be here tomorrow, I'll give it a shot.
I presume it should work if tempvolume is a single disk as well.
I'll post when I succeed/fail.
 

Hans Baumeister

Dabbler
Joined
Feb 20, 2014
Messages
23
Okay, I've got some results, but they aren't very good.
First of all, I needed some additional switches in both the send and receive commands. First of all, a "-r" to send recursively and then a "-rF" to receive recursively and force a write to the volume.
The transfer seemed to work, when I autoimported Temp, I was able to see all the datasets I had created and snapshotted.

Unfortunately, when I tried doing the reverse (after forcing a snapshot on Temp), even though the transfer back took hours, it apparently didn't transfer everything.

I ended up rebuilding the FreeNAS with the 4th drive installed (completely from scratch) and then using a regular cp command from the autoimported Temp volume to transfer the contents of each individual dataset to the new volume on the newly created NAS:

cp -iprv /mnt/Temp/Dataset1 /mnt/FinalData/Dataset1/

(the destination volume and dataset names are fictitious, of course).

Here are what the switches stand for:


i = Interactive. Will prompt you if overwriting files.
p = Preserve file attributes like date, time, etc.
r = Recursive. Will also copy subdirectories.
v = Verbose. Will show each file as it is copied.


 

Sir.Robin

Guru
Joined
Apr 14, 2012
Messages
554
If you have several datasets, you need to do a recursive snapshot. Or, one snap/zfs send for each dataset.

I did a recursive snapshot on the volume. Chceking you will then see all datasets have a snapshot with the same name.
Then i did a recursive send vol@snap1.

Done this several times and had no issues.

Not sure why you needed force to send back... didn't you recreate the volume? as in empty?
 

Hans Baumeister

Dabbler
Joined
Feb 20, 2014
Messages
23
Yep - recursive snapshot on the volume was done and I also saw that it generated a snapshot for each data set - so far so good. Why it didn't work the way I expected I'll probably never know. Thanks anyways!
 
Status
Not open for further replies.
Top