Migrating data between pools on same system

All your general support questions for OpenZFS on OS X.

Migrating data between pools on same system

Postby LaMosca » Fri Jan 11, 2019 10:18 am

I have a current 8-disk rz2 ZFS pool and will be setting up a new one to replace it and I'm wondering what is the best way to migrate all the data/filesystems.

Here's what I have currently on this pool (from `zfs list`):

rz2
rz2/VirtualMachines
rz2/archive
rz2/backups
rz2/documents
rz2/media
rz2/pictures

I would say I'm a basic O3X user and the only other time I've shifted data from one pool to another, I just used rsync, but I've seen some mentions of zfs send/receive as another potentially better way to copy the data. If someone could provide basic steps and commands knowing the structure I have.

Thanks in advance for the help :)
LaMosca
 
Posts: 2
Joined: Thu Jan 10, 2019 9:34 am

Re: Migrating data between pools on same system

Postby lundman » Mon Jan 14, 2019 4:00 pm

Make a snapshot of the filesystem you want, naming the snapshot what you want:

zfs snapshot rz2/media@20190115 (or zfs snapshot rz2/media@SuperBackup - dates are just convenient).

send said snapshot to another pool (and/or dataset)

zfs send rz2/media@20190115 | zfs recv otherpool

Would make otherpool/media, so you could use "otherpool/backup-of-media" etc.

The " | " here is "pipe", piping the output of "zfs send" into another command, "zfs recv". That would be on the same PC. Very often used like

zfs send rz2/media@20190115 | ssh another.server.com 'zfs recv otherpool'

Where you send it to another server you have, run 'zfs recv' to receive it.


You can now delete the snapshot: zfs destroy rz2/media@20190115

But it is very common to not delete it, and send incremental:

The next day's snapshot:

zfs snapshot rz2/media@20190116

Send only the difference:

zfs send -i rz2/media@20190115 rz2/media@20190116 | zfs recv otherpool

Those are the basic steps. Then note you can snapshot a whole pool using arguments, and zfs send all datasets in one command as well. (-R?)

zfs send -v for more feedback while sending, sticking mbuffer in the pipe, like "zfs send | mbuffer | zfs recv" can help with throughput.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Migrating data between pools on same system

Postby LaMosca » Tue Jan 15, 2019 9:11 am

Thank you!
LaMosca
 
Posts: 2
Joined: Thu Jan 10, 2019 9:34 am

Re: Migrating data between pools on same system

Postby haer22 » Wed Jan 16, 2019 5:08 am

I use
* zfsnap.sh to take snapshots every hour och clean them up after X days
* zxfer to sync the snapshots of my "working" pools to my "backup" pool

Very handy and flexible. Has saved by ass several times.
haer22
 
Posts: 123
Joined: Sun Mar 23, 2014 2:13 am


Return to General Help

Who is online

Users browsing this forum: Google [Bot] and 34 guests