Migrate old server to new one

Status
Not open for further replies.

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I want to take my working server and copy all the data to a new server, then use the old one as a backup.

1) Is it ok if the 2 servers that have different host names but the pool is the same? In my case v1 for both.
2) To use replication my old server data directories would have to be a dataset to copy it to the new one?
3) Can I rename a data directory, create the dataset and then copy the renamed data directory to the dataset to convert the directory to a dataset?
4) I presume I would have to turn off my jails in the old server and just backup the data from the new server to the old one?
5) Or should I transfer the data to the new server with rsync and use replication to backup the new server after its all working?

I've read the docs on replication and various forum posts but still would appreciate some clarification.
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
1) Is it ok if the 2 servers that have different host names but the pool is the same? In my case v1 for both.
Yes but unadvisable as it can cause confusion for the person managing them.
2) To use replication my old server data directories would have to be a dataset to copy it to the new one?
This is kind of an ambiguous question. You can use replication for the entire pool or individual datasets. But no, you can't use the built it replication for an individual folder within a dataset
3) Can I rename a data directory, create the dataset and then copy the renamed data directory to the dataset to convert the directory to a dataset?
Rename the folder to something like folder_temp, make the new dataset, cp -R /mnt/pool/folder_temp /mnt/pool/dataset Obviously you need to adjust names and paths but you get the idea, VERIFY YOUR DATA, remove the temp folder.
4) I presume I would have to turn off my jails in the old server and just backup the data from the new server to the old one?
This sounds like two questions. Once about transfering data, and another about transferring jails. I would just do it all in one transfer with all jails, VMs, shares,etc disabled to prevent missing a change that happened during the transfer. Keep in mind the replication is based on snapshots. If anything changes after the snapshot that's being replicated, it won't be replicated.
5) Or should I transfer the data to the new server with rsync and use replication to backup the new server after its all working?
I would use zfs send/recv to clone the pool to the new server, verify everything and after a week or two, nuke the old server and reinstall FreeNAS from scratch to configure it for backups.

To be honest, I wouldn't use the built in replication to simply migrate data to a new server. I would do it from the command line. It's only a hand full of commands.
  1. stop all services, jails, VMs, everything.
  2. from ssh export the pool, this will create a snapshot named <poolname>@export
  3. use zfs send to send the export snapshot over netcat (a super simple way to send raw data over the network)
  4. shutdown the old server and forget about it until you're happy with the new one
  5. import the pool on the new server
  6. reboot the new server
  7. play
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
You should research each step and understand whats happening before just copypasta commands. Oracle has some great documentation on zfs send/recv though they use ssh. ssh is easier but potentially slower especially over 10gbe.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
You can use replication for the entire pool
To be honest, I wouldn't use the built in replication to simply migrate data to a new server. I would do it from the command line. It's only a hand full of commands.
  1. stop all services, jails, VMs, everything.
  2. from ssh export the pool, this will create a snapshot named <poolname>@export
  3. use zfs send to send the export snapshot over netcat (a super simple way to send raw data over the network)
  4. shutdown the old server and forget about it until you're happy with the new one
  5. import the pool on the new server
  6. reboot the new server
  7. play
After doing some internet searching/reading (including freenas docs and youtube videos) I wanted to give netcat a go as it would be faster without encryption for 2 local servers. I found site1 site2 .

Replication for the GUI was failing I believe because my media directory was not a dataset. So unfortunately last night I decided to go with the approach of renaming the media directory with the command mv media/* media2/ after which I could delete the media directory and recreate it as a dataset to send with replication after moving the data again. My pool was at 11.6 TiB and the media directory was 9.1 TiB. The next morning it was churning away still and for over 12 hours. I did some math that at 25 Mbytes/sec (from the report page of fn) it would take 110 days so I hit Ctrl-C to stop it. Now I'm not sure how to put it back with partial stuff in each directory. Would
Code:
mv -n media2/* media/
fix it without overwriting the data already still in the media directory?

getting back to your steps:
Step 3: The receiving server pool is v2 and Sending is v1. Can you confirm if I have the syntax correct and how long will it take for 11.6 TB over a gigabit Ethernet network approximately?

Receiving machine:
nc -l -p 9999 | zfs receive v2

Sending machine:
zfs send -v v1@export | nc -w 1800 192.168.5.48 9999 where the IP address is the receiving servers IP
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Can I use the command
cp –r –link media/* media2/* merged/

to merge the 2 directories in a new one? My impression is this will just move the links not the files themselves so less disk intensive. Then I could create a media dataset, delete the old media and media 2 directories and
Code:
cp -r --link merged/* media/
to put it all back into the media dataset after it's created.

Sorry for the basic question, I just don't want to make thinks worse.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Got the dataset setup and I'm able to replicate with GUI but it doesn't go to the same directory as the original snapshot.

I have a dataset on my server /mnt/v1/media which I would like to copy to another server whose volume name is v2. After creating a periodic snapshot for the dataset v1/media I setup replication for v1/media and remote volume dataset of v2/media. The replication seems to put the media directory in /mnt/v2/media/media. If I use a remote volume dataset of just v2 the replication fails. Any idea on what I'm doing wrong? I would like the remote server to have all the stuff in /mnt/v2/media.
 
Status
Not open for further replies.
Top