Move data to new harddrives

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
Hello,

i have a pool on my Truenas Box.
The current pool is a 3TB pool with 4x1TB harddrives.

I want to replace those 4 harddrives with 2 8TB ones so.

The current pool has two datasets, one for iocage and one for my data.

How can i transfer my data to the new harddrives, so that my iocage jails will continue to work?
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
Replace the disks one at a time and resilver. It will take a while - but you can continue to work as normal during the operation. Note that the expanded space will only be available when you have done all the disks

Oh, and make sure you have a backup first. Just in case
 

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
But now i have 4 disks and i want to replace them with only 2 disks.
Does that work?

If i replace one at a time, than i will have a pool with 2x 8TB and 2x 1TB harddrives right?
But i want a pool with 2x8TB only.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
So if I'm reading you right, you want to go from a RAIDZ1 pool of 4 disks to a pool of 2 mirrored disks?

In that case, it will depend on how many slots you have in your box and if you can have all 6 disks running at the same time or not as to how we would advise to proceed.

In any case, it will require the building of a new pool, stopping your jails (and sharing), the transfer of data to that new pool, rename the old pool, rename the new pool to the old pool name, restart your jails (and sharing) and if you want/need to, removing the old pool and its disks.
 

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
Yes all harddrives are connected right now and i created a new pool for the 2 new disks
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
OK, so if we have your current pool (I will refer to as if it were named "curent") and your new pool (which I will refer to as if it were named "new"... at least to begin with).

stop your jails and shares

zfs snapshot -r current@transfer

zfs send -R current@transfer | pv | zfs recv new

Once that's done:

in the GUI, Disconnect/Export the pool current (careful not to check the options to remove shares config and data).

zpool import current old

zpool export old

in the GUI, Disconnect/Export the pool new (careful not to check the options to remove shares config and data).

zpool import new current

zpool export current

in the GUI, import the pool current.

start your jails and shares

Now either remove the disks or optionally import the pool called old in the GUI
 
Last edited:

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
My old pool is called Data and my new one is Daten

Getting this error:

root@FreeNAS:~ # zfs snapshot -r Data@transfer
root@FreeNAS:~ # zfs send -R Data@transfer | pv | zfs recv Daten
cannot receive new filesystem stream: destination 'Daten' exists ]
must specify -F to overwrite it
75.1KiB 0:00:08 [8.82KiB/s] [ <=> ]
warning: cannot send 'Data@auto-2021-11-29_15-04': signal received
warning: cannot send 'Data@transfer': Broken pipe
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
The answer's there in the message...

zfs send -R Data@transfer | pv | zfs recv -F Daten
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
But now i have 4 disks and i want to replace them with only 2 disks.
Does that work?

If i replace one at a time, than i will have a pool with 2x 8TB and 2x 1TB harddrives right?
But i want a pool with 2x8TB only.
Sorry - missed that
 

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
Thank you, that worked perfectly,
only the command is zpool import / export and not zfs import / export
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
only the command is zpool import / export and not zfs import / export
Right... apparently I was distracted while writing that. Fixed it in the original post in case anyone else wants to use it.
 
Top