Bug 201504 - [geom_part] gpart bootcode highly ambiguous message (the wrong size)
Summary: [geom_part] gpart bootcode highly ambiguous message (the wrong size)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Andrey V. Elsukov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-12 19:22 UTC by Andrey Fesenko
Modified: 2015-07-28 08:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Fesenko 2015-07-12 19:22:14 UTC
If create small "freebsd-boot"
=>      40  30712240  da0  GPT  (15G)
        40      1600    1  efi  (800K)
      1640        32    2  freebsd-boot  (16K)

gptzfsboot too big for created partition
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 da0
gpart: /dev/da0p2: No error: 0
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-07-21 06:19:43 UTC
A commit references this bug:

Author: ae
Date: Tue Jul 21 06:18:43 UTC 2015
New revision: 285735
URL: https://svnweb.freebsd.org/changeset/base/285735

Log:
  lseek() allows an offset to be set beyond the end of file. Using
  it to check that partition has enough space to write bootcode doesn't
  work. Use the known size of provider instead.

  PR:		201504
  MFC after:	1 week

Changes:
  head/sbin/geom/class/part/geom_part.c
Comment 2 Andrey Fesenko 2015-07-22 00:44:54 UTC
Thanks, works perfectly

# gpart show md0
=>    40  204720  md0  GPT  (100M)
      40  204720       - free -  (100M)

# gpart add -t freebsd-boot -s 16K md0
md0p1 added
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 md0
gpart: /dev/md0p1: not enough space
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-07-28 08:22:55 UTC
A commit references this bug:

Author: ae
Date: Tue Jul 28 08:22:51 UTC 2015
New revision: 285936
URL: https://svnweb.freebsd.org/changeset/base/285936

Log:
  MFC r285735:
    lseek() allows an offset to be set beyond the end of file. Using
    it to check that partition has enough space to write bootcode doesn't
    work. Use the known size of provider instead.

    PR:		201504

Changes:
_U  stable/10/
  stable/10/sbin/geom/class/part/geom_part.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-07-28 08:25:57 UTC
A commit references this bug:

Author: ae
Date: Tue Jul 28 08:25:50 UTC 2015
New revision: 285937
URL: https://svnweb.freebsd.org/changeset/base/285937

Log:
  MFC r285735:
    lseek() allows an offset to be set beyond the end of file. Using
    it to check that partition has enough space to write bootcode doesn't
    work. Use the known size of provider instead.

    PR:		201504

Changes:
_U  stable/9/sbin/geom/class/part/
  stable/9/sbin/geom/class/part/geom_part.c
Comment 5 Andrey V. Elsukov freebsd_committer freebsd_triage 2015-07-28 08:27:45 UTC
Fixed in head/, stable/10 and stable/9. Thanks!