Migrating dataset from one zPool to another

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
Hi all.

So after a fair amount of swearing and battling got my LSI card flashed... It's in, and I have 3 drives visible.

So I have 2 options,
#1 create a new Zpool, and then migrate the current dataset from my current zPool ("Tank") over to the new one.

#2 or add these 3 drives as a 2nd vDev to my current zPool ("Tank").

I'm leaning towards option #1
(The data thats in the dataset is documents, photos, software, leaving behind all the movies and music on dataset "media" located on zPool: "Tank")

comments.

if I go with option one, creating a zPool is easy enough, what would be the best way of moving the dataset from one Zpool to a 2nd and keeping all permissions/ACL's etc in place,

G
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
if I go with option one, creating a zPool is easy enough, what would be the best way of moving the dataset from one Zpool to a 2nd and keeping all permissions/ACL's etc in place,

Code:
zfs snapshot -r pool/dataset@relocate
zfs send -R pool/dataset@relocate | zfs receive -v pool/dataset
 

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
so decoding that, source pool is called "tank", dataset is called "home"
new pool is called "bunker"

zfs snapshot -r tank/home@relocate
zfs send -R tank/home@relocate | zfs receive -v bunker/home

would that be correct...
I assume I don't recreate "home" open the receiving pool.

G
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
so decoding that, source pool is called "tank", dataset is called "home"
new pool is called "bunker"

zfs snapshot -r tank/home@relocate
zfs send -R tank/home@relocate | zfs receive -v bunker/home

would that be correct...
I assume I don't recreate "home" open the receiving pool.

G
That looks right.

You don't need to create the 'home' dataset in the bunker pool prior to sending. The zfs receive command will create the dataset in the target pool if it doesn't already exist.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
The zfs receive command will create the dataset in the target pool if it doesn't already exist.
And will throw an error if it does... you would need to use -F to overwrite an existing dataset.
 

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
now that home dataset is used as the home to various users, assume I will have to edit them, or will this be understood by the system as a move (assuming as I see the word relocate in the command.

G
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Relocate is just the name of the snapshot used (which you should probably delete when you're finished BTW).

You will need to update any reference from the old to new locations of the data.
 

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
so... did the above commands, and modified the 2 users who's home directories pointed to tank/home/* now pointing to bunker/home/*

does this now mean I can delete the tank/home/* ?

G
 

georgelza

Patron
Joined
Feb 24, 2021
Messages
417
curious...
I see under snapshots there is a couple pointing to tank/home, tank/home/george etc.
Now that I've moved the data to bunker/home/* can I delete the tank/home* snapshots

G
 
Top