[SoftNAS KB]: Volume Migration through Snapshots
Purpose:
This article is for those looking to migrate a volume from an existing pool and wish to migrate this volume onto another pool on the same machine, or another one. For example, you might wish to increase the performance of certain volume(s) so you need to migrate it to another pool with better EBS backend. You may also need to migrate a volume to another pool with much more free space. Another example might when you wish to migrate the volume(s) to another pool on different SoftNAS® Instance to break down the load.
Details:
To perform a snapshot-based migration, we will be first creating a snapshot for the volume to be moved, then we will transfer said snapshot, rather than the data in the volume itself, to the destination pool. This will minimize the downtime, keeping the data available throughout the majority of the process. We will then stop all write services to the volume, to ensure no data is lost in transition, create another snapshot, and migrate the second snapshot incrementally. The second migration will take far less time.
- Use the below command to create the first snapshot. Creating the snapshot will not require any downtime.
zfs
snapshot source-pool/volumex@Full
- Next, send the snapshot to the destination pool. This will not cause downtime, but may adversely affect performance, so we recommend this task be performed outside of business hours.
The commands will differ, depending on whether you are migrating to a pool on the same machine, or to one on a separate SoftNAS Instance:- If migrating to a pool on the same SoftNAS Instance:
zfs
send -R source-pool/volumex@Full |
zfs
receive -s destination-pool/
volumey
- If migrating to a pool on a different instance:
zfs send -R source-pool/volumex@Full | ssh -i PATH/TO/DESTINATION/PRIVATE-KEY -l root IP-OF-DESTINATION-SOFTNAS zfs receive -s destination-pool/volumey
- If migrating to a pool on the same SoftNAS Instance:
- Next, turn off writing to the source volume. You can do this by bringing your application offline, or shutting down NFS or Samba.
- Take the final snapshot.
zfs snapshot source-pool/volumex@Final
- Next, send this volume incrementally, using the final snapshot. Only data modified since the full snapshot and the final snapshot will be sent.
- If migrating your volume from one pool to another on the same machine:
zfs send -R -i source-pool/volumex@Full source-pool/volumex@Final | zfs receive destination-pool/volumey
- If migrating your volume to a pool on another SoftNAS Instance:
zfs send -R -i source-pool/volumex@Full source-pool/volumex@Final | ssh -i PATH/TO/DESTINATION/
PRIVATE
-KEY -l root IP-OF-DESTINATION-SOFTNAS zfs receive destination-pool/volumey
- If migrating your volume from one pool to another on the same machine:
- Now you have the volume migrated to the new pool, whether on the same instance or a separate one. You can now go to the UI and check the results, and do any final housekeeping like modifying or adding the required sharing entries, and directing your clients or applications to use the new share name and/or IP address.
For more information on how to perform these tasks, click the link below:
https://softnas.com/helpdesk/index.php?/Knowledgebase/Article/View/95/0/softnas-kb-migrate-softnas-on-aws-from-vpc-to-vpc-within-a-region
Notes:
- The destination file system should not be an existing, active instance, as this negates the value of the process - the destination file system will endure downtime.
- The destination file system will not be accessible during the migration.
- Older snapshots will be included in the migration as you keep using the option -R.
In case the transmission of the Full snapshot failed you still can resume using the resume token. You can get the resume token from the target machine using the below command:
zfs get -H -o value receive_resume_token destination-pool/volumey
Then you can send from the source node based on this token using the below command:
zfs send -t YOURT-TOKEN | zfs receive -s destination-pool/volumey #SoftNAS Instance
zfs send -t YOURT-TOKEN | ssh -i PATH/TO/DESTINATION/PRIVATE-KEY -l root IP-OF-DESTINATION-SOFTNAS zfs receive -s destination-pool/volumey # different instance