ZFS on linux: switch partition to whole disk

1

0

There is a ZFS pool with raidz1 in it. The pool is created on top of three 2TB drives using the whole disk and a 2TB partition on a 3TB drive.

What is the recommended process to reconfigure the pool to use the whole 3TB disk instead of the partition?

I read a lot the zfs manual (man zpool) but I'm not sure which commands should be used: attach/detach or online/offline and the pool shold be exported or not.

Because the the array is almost full of data, I don't like the idea to just stab in the dark and play with it.

Also, I ran zpool scrub multiple times and it finished without errors.

EdgarPE

Posted 2014-05-06T11:18:08.510

Reputation: 387

You wouldn’t be able to utilize the space either way. In RAID arrays, the smallest member determines the usable array size. This is true even for software RAID. – Daniel B – 2014-05-06T11:58:17.100

@DanielB Yes, I know. Later I can replace the 2TB disks too, but that is a simple task. – EdgarPE – 2014-05-06T14:52:25.623

I see. Well, the procedure isn’t that complex, I’ll write an answer later. You are aware, however, that this will result in a resilver, right? – Daniel B – 2014-05-06T15:03:56.290

Answers

1

I managed to solve the problem. Actually it is not that hard. Here are the steps:

  1. Do a complete scrub on the pool zpool scrub POOL
  2. Make the disk partition offline with zpool offline POOL PARTITIN
  3. Check the status with zpool status POOL, it should be in a degraded but working status.
  4. Here is the tricky part. You have to make zpool to forget that that partition ever was in that pool. I simply used dd to overwrite a few Mb-s on beginning of the disk, like this: dd if=/dev/urandom of=DISK bs=1M count=10
  5. The last step is to use the replace command like this: zpool replace POOL OLD-PARTITION NEW-WHOLE-DISK
  6. The previous step will initiate a resilvering of course. After that was finished I made another scrub just to be sure :)

EdgarPE

Posted 2014-05-06T11:18:08.510

Reputation: 387