Project

General

Profile

Bug #21336

Add ability to attach smaller disk to a larger one

Added by Richard Kojedzinszky over 1 year ago. Updated 10 months ago.

Status:
Resolved
Priority:
Nice to have
Assignee:
William Grzybowski
Category:
OS
Target version:
Seen in:
Sprint:
Severity:
New
Backlog Priority:
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

I've run into a situation, where we installed freenas on a 16G and a 32G usb flash mirrored. The idea was that using two different manufacturers may provide more robustness. Now our smallest drive failed. I detached that from the pool, the pool remained at the same size. We obtained another 16G drive, we tried to attach that to the existing 32G drive, but that failed. Maybe that behaviour is intended, although the pool could have accepted that to operate as before the failure. Btw it works on zfsonlinux stable on debian.

I've attached a small script which demonstrates the issue. I know, I should have not detached the failed disk, instead I should have done a replace.

pool-replace.sh (561 Bytes) pool-replace.sh Richard Kojedzinszky, 02/21/2017 03:17 AM

Related issues

Related to FreeNAS - Feature #23455: Detach device from mirrored boot poolResolved2017-04-19

Associated revisions

Revision 2ba44194 (diff)
Added by William Grzybowski 12 months ago

feat(middlewared/boot): use same size of the older partition

Ticket: #21336

Revision 64cf0a9a (diff)
Added by William Grzybowski 12 months ago

feat(middlewared/boot): make expanding boot disk attach optional

Ticket: #21336

Revision 8acbd65f (diff)
Added by William Grzybowski 12 months ago

feat(gui): add `expand` option to boot disk attach

Ticket: #21336

Revision a8556137 (diff)
Added by William Grzybowski 12 months ago

fix(gui): typo - s/disable/disabled/

Ticket: #21336

Revision f532c15a (diff)
Added by William Grzybowski 12 months ago

feat(middlewared/boot): use same size of the older partition

Ticket: #21336

Revision b8c3f0e1 (diff)
Added by William Grzybowski 12 months ago

feat(middlewared/boot): make expanding boot disk attach optional

Ticket: #21336

Revision 1ae19b92 (diff)
Added by William Grzybowski 12 months ago

feat(gui): add `expand` option to boot disk attach

Ticket: #21336

Revision 8cc5a35c (diff)
Added by William Grzybowski 12 months ago

fix(gui): typo - s/disable/disabled/

Ticket: #21336

Revision 399ff3a9 (diff)
Added by William Grzybowski 11 months ago

fix(middlewared/boot): specify size in bytes

Ticket: #21336

Revision b0dd0056 (diff)
Added by William Grzybowski 11 months ago

fix(gui): raise traceback if something bad occurs

Ticket: #21336

Revision a9c98e4e (diff)
Added by William Grzybowski 11 months ago

fix(middlewared/boot): specify size in bytes

Ticket: #21336
(cherry picked from commit 399ff3a975ab01d0e0a2ca3425b4d716d6b419fb)

Revision 421251e8 (diff)
Added by William Grzybowski 11 months ago

fix(gui): raise traceback if something bad occurs

Ticket: #21336
(cherry picked from commit b0dd005648200136068eb20dddea9585a71affcd)

Revision 79b9b889 (diff)
Added by William Grzybowski 11 months ago

fix(middlewared/boot): specify size in bytes

Ticket: #21336
(cherry picked from commit 399ff3a975ab01d0e0a2ca3425b4d716d6b419fb)

Revision ef3c868c (diff)
Added by William Grzybowski 11 months ago

fix(gui): raise traceback if something bad occurs

Ticket: #21336
(cherry picked from commit b0dd005648200136068eb20dddea9585a71affcd)

History

#1 Updated by Bonnie Follweiler over 1 year ago

  • Assignee set to Kris Moore

#2 Avatar?id=14398&size=24x24 Updated by Kris Moore over 1 year ago

  • Assignee changed from Kris Moore to William Grzybowski
  • Target version set to 9.10.4

William, Not sure the original decision behind this. Do we intentionally check the disk size vs the partition size for the zpool?

#3 Updated by William Grzybowski over 1 year ago

  • Status changed from Unscreened to 15

How did that fail, exactly?

Are you sure the 16gb is not a few KB smaller than the last one?

the autoexpand property of the freebas-boot pool is off by default.

#4 Updated by Richard Kojedzinszky over 1 year ago

I think the failure is irrelevant in this scenario, but actually it is a Sandisk cruzer fit drive, and I suppose it has some firmware bug, it just stopped working. After a removal/reinsert it is detected again and works fine, but this is not acceptable for us in reliability.

As I wrote, initially we created a pool with a 16G and a 32G disk mirrored, thus resulted in a 16G pool size. My fault is probably that I removed the 16G device (and not issued a replace). So after the removal, and with autoexpand off, the pool is still at 16G of size. And unfortunately, I cannot attach a 32G drive to the existing one (which is again a 32G), which is somewhat smaller, but indeed larger than the initial 16G one. The pool has still 16G of size.

So now I assume I can only attach a 32G drive which has at least any sectors as the old one (or 64G) to an existing, 16G size pool. That is my only problem.

#5 Updated by William Grzybowski over 1 year ago

Richard Kojedzinszky wrote:

I think the failure is irrelevant in this scenario, but actually it is a Sandisk cruzer fit drive, and I suppose it has some firmware bug, it just stopped working. After a removal/reinsert it is detected again and works fine, but this is not acceptable for us in reliability.

As I wrote, initially we created a pool with a 16G and a 32G disk mirrored, thus resulted in a 16G pool size. My fault is probably that I removed the 16G device (and not issued a replace). So after the removal, and with autoexpand off, the pool is still at 16G of size. And unfortunately, I cannot attach a 32G drive to the existing one (which is again a 32G), which is somewhat smaller, but indeed larger than the initial 16G one. The pool has still 16G of size.

So now I assume I can only attach a 32G drive which has at least any sectors as the old one (or 64G) to an existing, 16G size pool. That is my only problem.

Sorry, I still not seeing the problem here.

The installer finds the disks with smaller size and creations a partition one each disk with the minimal size between the two.
Its virtually impossible for the pool to autoexpand to the disk size, even if you ended detaching the other disk from the pool.

I dont understand how that is possible.
Your proof script is flawed in that sense, because it does not create partitions of the same size as the installer does.

Perhaps you have installed FreeNAS before it was a feature? (April 2015)

#6 Updated by Richard Kojedzinszky over 1 year ago

Maybe I've installed on only the 16G disk, and later attached the 32G disk to the pool. Actually, the attach method on UI does this exactly. And actually I was targeting this question as a ZFS request, not a freenas UI request.

#7 Updated by William Grzybowski over 1 year ago

  • Status changed from 15 to Screened

Richard Kojedzinszky wrote:

Maybe I've installed on only the 16G disk, and later attached the 32G disk to the pool. Actually, the attach method on UI does this exactly. And actually I was targeting this question as a ZFS request, not a freenas UI request.

ZFS is behaving correctly from my point of view here.

I'll make sure the UI does the right thing when attaching a disk to the boot pool (as in partitioning to the smallest disk size).

#8 Updated by Richard Kojedzinszky over 1 year ago

Through UI one can get to the same situation, as the UI attach feature creates a partition with all the space in the drive. Actually my original question is that why ZFS does not attach a partition which is actually smaller than other vdevs, but still has enough space to hold pool data?

#9 Avatar?id=14398&size=24x24 Updated by Kris Moore over 1 year ago

  • Target version changed from 9.10.4 to 11.1

#10 Updated by William Grzybowski 12 months ago

  • Status changed from Screened to Needs Developer Review
  • Assignee changed from William Grzybowski to Vladimir Vinogradenko
  • Target version changed from 11.1 to 11.1-BETA1

#12 Updated by Vladimir Vinogradenko 12 months ago

  • Status changed from Needs Developer Review to Reviewed by Developer
  • Assignee changed from Vladimir Vinogradenko to William Grzybowski

#13 Updated by William Grzybowski 12 months ago

  • Status changed from Reviewed by Developer to Ready For Release

#14 Updated by Dru Lavigne 12 months ago

  • Subject changed from Attach smaller disk to a larger one to Add ability to attach smaller disk to a larger one

#15 Updated by Dru Lavigne 12 months ago

  • Status changed from Ready For Release to Resolved

#16 Updated by Nick Wolff 11 months ago

Testing Procedure:

Testing this by creating a 10g 16g and 20g zvol to back a freenas vm. I will then install to the 10g and 20g disk. Once installed detach 10g zvol and attempt to then attach 16g zvol. That should now work and be a passing test

#17 Updated by Nick Wolff 11 months ago

  • QA Status Test Fails FreeNAS added
  • QA Status deleted (Not Tested)

Attach appears successful in ui but fails. Efi partition is created but next partition creation fails. It appears gpart takes size in number of sectors if no suffix is added. Adding a 'B' to the size argument should allow you to easily use the mediasize number from the boot disk your mirroring.

/var/log/middlewared.log
[2017/11/08 06:52:15] (WARNING) application.call_method():174 - Exception while calling boot.attach(*['ada1', {'expand': False}])
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 150, in call_method
result = await self.middleware.call_method(self, message)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 883, in call_method
return await self._call(message['method'], methodobj, params, app=app)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 860, in _call
return await methodobj(*args)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/schema.py", line 491, in nf
return await f(*args, **kwargs)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/boot.py", line 125, in attach
boottype = await self.format(dev, format_opts)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/schema.py", line 491, in nf
return await f(*args, **kwargs)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/boot.py", line 74, in format
await run(*command)
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in next
return self.gen.send(None)
File "/usr/local/lib/python3.6/site-packages/middlewared/utils.py", line 65, in run
cp.check_returncode()
File "/usr/local/lib/python3.6/subprocess.py", line 369, in check_returncode
self.stderr)
subprocess.CalledProcessError: Command '('gpart', 'add', '-t', 'freebsd-zfs', '-i', '2', '-a', '4k', '-s', '10464698368', 'ada1')' returned non-zero exit status 1.

#18 Updated by Dru Lavigne 11 months ago

  • Status changed from Resolved to Unscreened

William: please check results with QA.

#19 Updated by William Grzybowski 11 months ago

  • Status changed from Unscreened to Needs Developer Review
  • Assignee changed from William Grzybowski to Vladimir Vinogradenko

#20 Updated by Dru Lavigne 11 months ago

  • Target version changed from 11.1-BETA1 to 11.1

#21 Updated by Vladimir Vinogradenko 11 months ago

  • Status changed from Needs Developer Review to Reviewed by Developer
  • Assignee changed from Vladimir Vinogradenko to William Grzybowski

#22 Updated by Bonnie Follweiler 11 months ago

  • Related to Feature #23455: Detach device from mirrored boot pool added

#23 Updated by William Grzybowski 11 months ago

  • Status changed from Reviewed by Developer to Ready For Release
  • QA Status Not Tested added
  • QA Status deleted (Test Fails FreeNAS)

#24 Updated by William Grzybowski 11 months ago

  • Tracker changed from Feature to Bug
  • Seen in set to 11.1-RC1
  • ChangeLog Required set to No

#25 Updated by Dru Lavigne 11 months ago

  • Target version changed from 11.1 to 11.1-RC2

#26 Updated by Dru Lavigne 11 months ago

  • Target version changed from 11.1-RC2 to 11.1-RC3

#27 Updated by Dru Lavigne 11 months ago

  • Status changed from Ready For Release to Resolved

#28 Updated by Bonnie Follweiler 11 months ago

  • Status changed from Resolved to Unscreened
  • QA Status Test Fails FreeNAS added
  • QA Status deleted (Not Tested)

As in https://redmine.ixsystems.com/issues/26663

root@freenas:~ # grep gpart /var/log/middlewared.log
subprocess.CalledProcessError: Command '('gpart', 'add', '-t', 'freebsd-zfs', '-i', '2', '-a', '4k', '-s', '53686521856', 'ada2')' returned non-zero exit status 1.
root@freenas:~ #

It looks like this was pulled into Master but not in 11.1 Stable https://github.com/freenas/freenas/pull/421

#29 Updated by William Grzybowski 11 months ago

  • Status changed from Unscreened to Screened
  • Target version changed from 11.1-RC3 to 11.1
  • QA Status Not Tested added
  • QA Status deleted (Test Fails FreeNAS)

#30 Updated by William Grzybowski 11 months ago

  • Status changed from Screened to Needs Developer Review
  • Assignee changed from William Grzybowski to Vladimir Vinogradenko

#31 Updated by Vladimir Vinogradenko 11 months ago

  • Status changed from Needs Developer Review to Reviewed by Developer
  • Assignee changed from Vladimir Vinogradenko to William Grzybowski

#32 Updated by William Grzybowski 11 months ago

  • Status changed from Reviewed by Developer to Ready For Release

#33 Updated by Nick Wolff 10 months ago

  • Needs QA changed from Yes to No
  • QA Status Test Passes FreeNAS added
  • QA Status deleted (Not Tested)

#34 Updated by Dru Lavigne 10 months ago

  • Status changed from Ready For Release to Resolved

Also available in: Atom PDF