How-to move homes from PoolA to PoolB's home datasets

Status
Not open for further replies.

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Hi everyone,
how can I migrate each users' home from PoolA to a separate dataset in PoolB, please?

I have 3 home folders in the "old" PoolA of my (Free)NAS; I'd like to migrate each of these homes to a dataset in the new PoolB on the same (Free)NAS. However, I am a bit confused on how-to.

I googled a bit and checked some threads of the forum, and as far as I understood there are two "safe" ways:
1. use rsync (e.g. "rsync -rvpEt /mnt/PoolA/HomeX /mnt/PoolB/DatasetHomeX", where HomeX and DatasetHomeX are members of "homes" set);
2. use zfs (e.g. "zfs send -vp PoolA@Snapshot | zfs receive -dv PoolB/DatasetHomeX", I suppose).

While the rsync method seems more straightforward to me, I had to reset all permissions of homes and I got some errors by symlinks. Hence, I believe that the migration was 1 to 1; probably, I have to use -a parameter.

Instead, zfs method seems more tricky to me, as it is based on snapshots of PoolA which contains the homes as folders and not as datasets. Hence, once the PoolA snapshot has been replicated on PoolB, I do not know how to migrate the single homes to each dataset... maybe rsync, then it would be better to use it from the beginning, is it not?

Doeas anyone know how could I manage to migrate these homes to the new datasets, please?

Thanks in advance ;)
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Three easy steps.

Take a snapshot, send the snapshot, clean up the snapshot.

Code:
# zfs snap oldtank/home@tobemoved
# zfs send oldtank/home@tobemoved | zfs recv newtank/home
# zfs destroy oldtank/home@tobemoved


Once done, you can delete the dataset from the old pool.

These commands will work with any dataset. If you have nested datasets and want to re-locate them at the same time, replace zfs snap with zfs snap -r and zfs send with zfs send -R
 

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Three easy steps.

Take a snapshot, send the snapshot, clean up the snapshot.

Code:
# zfs snap oldtank/home@tobemoved
# zfs send oldtank/home@tobemoved | zfs recv newtank/home
# zfs destroy oldtank/home@tobemoved


Once done, you can delete the dataset from the old pool.

These commands will work with any dataset. If you have nested datasets and want to re-locate them at the same time, replace zfs snap with zfs snap -r and zfs send with zfs send -R

Great, thanks a lot! ;)
Therefore, I should repeat the same for each home in the homes set, am I right?
For example, oldtank/HomeX, oldtank/HomeZ, oldtank/HomeY.
 

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Code:
# zfs snap oldtank/home@tobemoved
# zfs send oldtank/home@tobemoved | zfs recv newtank/home
# zfs destroy oldtank/home@tobemoved
@m0nkey_ I am haveing some issue by following these steps :(
When I run:
Code:
# zfs snap oldtank/homeX@tobemoved

I get:
Code:
dataset does not exist

In fact, my dataset is only "oldtank" while "homeX" is just an folder.

I also tryed to run:
Code:
# zfs snap /mnt/oldtank/homeX@tobemoved

However, I get:
Code:
dataset does not exist


Do you know if it is possible to snap the whole "oldtank" volume/dataset and recv only from the home folders in each dataset of "newtank"? :)
 

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Please paste the output of zfs list using the code tags.
@m0nkey_ here we go ;)
Code:
# zfs list                                                                                                        
NAME                                                   USED  AVAIL  REFER  MOUNTPOINT                                              
eco                                                   2.76T   766G  2.76T  /mnt/eco                                                
eco/.system                                            174M   766G   277K  legacy                                                  
eco/.system/configs-e993459e882f47d1a75668b8c19f897f  18.4M   766G  17.7M  legacy                                                  
eco/.system/configs-f38d52b457b54175b01b7afa95baf74a   650K   766G   650K  legacy                                                  
eco/.system/cores                                     18.2M   766G  18.1M  legacy                                                  
eco/.system/rrd-e993459e882f47d1a75668b8c19f897f       192K   766G   192K  legacy                                                  
eco/.system/rrd-f38d52b457b54175b01b7afa95baf74a       234K   766G   234K  legacy                                                  
eco/.system/samba4                                    22.0M   766G  5.26M  legacy                                                  
eco/.system/syslog-e993459e882f47d1a75668b8c19f897f    110M   766G  54.8M  legacy                                                  
eco/.system/syslog-f38d52b457b54175b01b7afa95baf74a   2.93M   766G  2.80M  legacy                                                  
freenas-boot                                           652M  13.8G    64K  none                                                    
freenas-boot/ROOT                                      645M  13.8G    29K  none                                                    
freenas-boot/ROOT/Initial-Install                        1K  13.8G   635M  legacy                                                  
freenas-boot/ROOT/default                              645M  13.8G   638M  legacy                                                  
freenas-boot/grub                                     6.35M  13.8G  6.35M  legacy                                                  
wolf                                                  1.91T  3.36T    88K  /mnt/wolf                                              
wolf/X                                                88K  3.36T    88K  /mnt/wolf/X                                          
wolf/Y                                          1.91T  3.36T  1.91T  /mnt/wolf/Y                                      
wolf/Z                                             88K  3.36T    88K  /mnt/wolf/Z                                        
wolf/K                                             88K  3.36T    88K  /mnt/wolf/K


In eco volume there are users home folders (i.e. X,Y, Z, and K), while in wolf volume there is a dataset for each user.
 

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Should I do a
Code:
cp -a ... ...
of each home folder into its new dataset? : \
 

juspolo

Dabbler
Joined
Nov 14, 2016
Messages
14
Finally, I managed to migrate the homes in each dataset by using zfs snaps:
  1. snap the old volume;
  2. send | recv the snap on the new volume in dataset k;
  3. delete home k from old volume;
  4. delete other homes from the new volume home k dataset;
  5. move to point 1 untill all each dataset contains its home.
Thanks to @m0nkey_ for the guide lines ;)
 
Status
Not open for further replies.
Top