Re-using disks that have been part of a ZFS pool?

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

Re-using disks that have been part of a ZFS pool?

Postby Sharko » Sat May 12, 2018 12:34 pm

Hey, what is the best way to recycle a disk that was formerly used in a zfs pool to start a new pool? Do I need to worry about the fact that ZFS has put special magic identifiers at the start end of the disk to mark it as part of a ZFS pool? Or do I just export the old pool, and then zpool create away?
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Re-using disks that have been part of a ZFS pool?

Postby abc123 » Sun May 13, 2018 8:47 pm

Sharko wrote:Hey, what is the best way to recycle a disk that was formerly used in a zfs pool to start a new pool? Do I need to worry about the fact that ZFS has put special magic identifiers at the start end of the disk to mark it as part of a ZFS pool? Or do I just export the old pool, and then zpool create away?


If you can import the pool then do a zpool destroy on it. Then you can reuse the disks.
abc123
 
Posts: 63
Joined: Mon Jan 30, 2017 11:46 pm

Re: Re-using disks that have been part of a ZFS pool?

Postby Sharko » Mon May 14, 2018 8:27 pm

Super, thanks, I should have thought of that!
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Re-using disks that have been part of a ZFS pool?

Postby FadingIntoBlue » Mon May 14, 2018 11:15 pm

I’m pretty sure you can use the -f flag with create and add to force using a previously allocated disk. I know I have been able to add a disk to create a mirror in that situation, anyway.
FadingIntoBlue
 
Posts: 106
Joined: Tue May 27, 2014 12:25 am

Re: Re-using disks that have been part of a ZFS pool?

Postby Sharko » Tue May 29, 2018 7:06 am

Been thinking about this a little more... my main pool up until now has consisted of four 2TB spinning disks, set up as a 2 x 2 mirror pool. I'm thinking of picking up one of these used HP microservers to run FreeNAS on, and putting all four disks in there. It would be sweet if I could preserve the data that's already on these four disks as the starting point for future backups, since it is all there now. The only problem is that each of the four drives is encrypted with the filevault method, and FreeNAS isn't going to know what to do with that.

What I was originally thinking was to remove one of the disks, perform some terminal or linux magic on it to make it note appear as though it is not a ZFS or encrypted disk, then put it back in the array as a replacement disk to cause a re-silver. Repeat three more times, and then I would have a non-encrypted array that should be recognized by FreeNAS.

Another way would be to just pull two of the redundant disks, put them in the FreeNAS box (where they won't be recognized as containing data), and let the original pool run in a degraded state while I do a ZFS send receive from Mac OS X to FreeNAS.

I'm guessing that it isn't possible to simply reverse the Filevault encryption on the existing disks, since even if that is possible they are part of a corestorage volume which FreeNAS probably doesn't understand, right?

I would welcome your thoughts on the best strategy going forward.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Re-using disks that have been part of a ZFS pool?

Postby FadingIntoBlue » Tue May 29, 2018 2:59 pm

I think you have a few more factors to consider than just the Filevault encryption and the core storage issue. I have found difficulty in moving disks from one enclosure to another, primarily with USB, but on occasion with Thunderbolt. I suspect it is something to do with some combination of bridge hardware, disks, disk order and how the enclosure presents to ZFS, if that makes any sense. I haven't used eSATA so not sure if there is an issue there. The approach I'd take is:

2: Back up your existing data (you already have a backup or two right? ZFS is not a backup strategy by itself)
2: Split both your existing mirrors, leaving you with two copies of all your data
3: Take 1 disk from each split mirror, and install in the FreeNAS box
4: Create a zpool by adding the 2 disks together - no redundancy at this stage
5: Copy your data from the existing pool to the new pool (zfs send, rsync, finder or whatever)
6: Once you have a successful copy, take the disks from the old pool, and use them to mirror the disks in the FreeNAS box

That might be a bit of a long winded approach, but it avoids the underlying encryption and disk format issues. You never have less than 2 copies of your data, so it is reasonably safe from that point of view too. Of course buying a new set of disks for the FreeNAS box is a lot simpler, but not nearly as frugal.
FadingIntoBlue
 
Posts: 106
Joined: Tue May 27, 2014 12:25 am

Re: Re-using disks that have been part of a ZFS pool?

Postby tangles » Sat Jun 16, 2018 12:18 am

if you want to roll back a disk so that it appears as if it were direct from the factory:
Code: Select all
sudo umountDisk force /dev/diskn ; sudo dd if=/dev/diskn of=/dev/rdiskn bs=1024 count=5120000

where "n" is the disk in question.
This will unmount and erase the first ~50MB back to zeros, which will do what you need to do.

If you want to do the whole disk, then leave off the count attribute and be prepared to wait… and wait…

The above command is quite dangerous! so here's some one liners I use to help ensure I'm playing with the correct disk:
Code: Select all
diskutil list physical

and you can drill down to look at serial numbers of disks using:
Code: Select all
ioreg -rd1 -w0 -c AppleAHCIDiskDriver


Cheers,
tangles
 
Posts: 195
Joined: Tue Jun 17, 2014 6:54 am


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 14 guests

cron