History log of /freebsd-10.2-release/sys/geom/part/g_part_mbr.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 285830 23-Jul-2015 gjb

- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.2.
- Update default pkg(8) configuration to use the quarterly branch.[1]

Discussed with: re, portmgr [1]
Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 282861 13-May-2015 ae

MFC r282465:
Add apple-boot, apple-hfs and apple-ufs aliases to MBR scheme.
Sort DOSPTYP_* entries in diskmbr.h by value.
Document these scheme-specific types in gpart(8).


# 271636 15-Sep-2014 emaste

MFC EFI support for the installer

r264978 (nwhitehorn):

Add EFI support to the installer. This requires that the kernel
provide a sysctl to determine what firmware is in use. This sysctl
does not exist yet, so the following blocks are in front of the
wheels:
- I've provisionally called this "hw.platform" after the equivalent
thing on PPC
- The logic to check the sysctl is short-circuited to always choose
BIOS. There's a comment in the top of the file about how to turn
this off.

If IA64 acquired a boot1.efifat-like thing (probably with very few
modifications), the same code could be adapted there.

r265016 (nwhitehorn):

Finish connecting up installer UEFI support. If the kernel was
booted using EFI, set up the disks for an EFI system. If booted from
BIOS/CSM, set up for BIOS.

r268256 (nwhitehorn):

After EFI support was added to the installer, it needed to allow
boot partitions of types other than "freebsd-boot" (in particular,
"efi"). This allows the removal of some nasty hacks for supporting
PowerPC systems, in particular aliasing freebsd-boot to apple-boot
on APM and an IBM-specific code on MBR.

This changes the installer to use the correct names, which also
breaks a degeneracy in the meaning of "freebsd-boot" that allows the
addition of support for some newer IBM systems that can boot from
GPT in addition to MBR. Since I have no idea how to detect which
those systems are, leave the default on IBM PPC systems as MBR for
now.

Approved by: re
PR: 193658
Relnotes: Yes


# 270552 25-Aug-2014 ae

MFC r268407 (by gjb):
Fix non-version text after .Fx macro usage.

MFC r269487 (by issyl0):
Add generic list, status, load and unload docs to gpart(8)

- In the style of gmirror(8).
PR: docs/191534

MFC r269852:
Add sysctl and loader tunable kern.geom.part.mbr.enforce_chs that is set
by default. It can be used to disable automatic alignment to CHS geometry,
that GEOM_PART_MBR does.


# 265912 12-May-2014 ae

MFC r256690:
Add an automatic resize support to the GEOM_PART class.

When parent provider has been resized, the scheme specific G_PART_RESIZE
method does an update of scheme's metadata. But all changes are not saved
to disk, until `gpart commit` will be called.

MFC r265336:
Add an advice what to do when partition was automatically resized.


# 265910 12-May-2014 ae

MFC r265318:
For schemes that do an automatic partition aligning move this code to
separate function.

MFC r265331:
Prevent an unexpected shrinking on resizing due to alignment for MBR,
PC98 and VTOC8 schemes.

MFC r265333:
Add better error description for case when we are doing resize and
scheme-specific method returns EBUSY.

MFC r265539:
It is safe to allow shrinking, when aligned size is bigger than current.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 251588 09-Jun-2013 marcel

Change the set and unset ctlreqs by making the index argument optional.
This allows setting attributes on tables. One simply does not provide
an index in that case. Otherwise the entry corresponding the index has
the attribute set or unset.

Use this change to fix a relatively longstanding bug in our GPT scheme
that's the result of rev 198097 (relatively harmless) followed by rev
237057 (damaging). The damaging part being that our GPT scheme always
has the active flag set on the PMBR slice. This is in violation with
EFI. Existing EFI implementions for both x86 and ia64 reject the GPT.
As such, GPT disks created by us aren't usable under EFI because of
that.

After this change, GPT disks never have the active flag set on the PMBR
slice. In order to make the GPT disk bootable under some x86 BIOSes,
the reason of rev 198097, one must now set the active attribute on the
gpt table. The kernel will apply this to the PMBR slice For (S)ATA:
gpart set -a active ada0

To fix an existing GPT disk that has the active flag set in the PMBR,
and that does not need the flag, use (again for (S)ATA):
gpart unset -a active ada0

The EBR, MBR & PC98 schemes, which also impement at least 1 attribute,
now check to make sure the entry passed is valid. They do not have
attributes that apply to the table.


# 247961 07-Mar-2013 gavin

Support the FAT16 partition type in gpart(8)

PR: kern/174714
Submitted by: 4721 at hushmail dot com
MFC after: 1 week


# 234417 18-Apr-2012 marck

VMware environments are not unusual now. Add VMware partitions recognition
(both MBR for ESXi <= 4.1 and GPT for ESXi 5) to g_part.

Reviewed by: ae
Approved by: ae
MFC after: 2 weeks


# 231928 20-Feb-2012 ae

Add alias for the partition type 0x0f. Now "ebr" name is used for both
types 0x05 and 0x0f, but 0x05 is preferred and used when partition is
created with "gpart add -t ebr ...".
This should keep EBR partitions accessible after r231754 for those,
who have EBR on the partition with type 0x0f.


# 231367 10-Feb-2012 ae

Add alias for the partition with type 0x42 to the MBR scheme.

MFC after: 1 week


# 230522 25-Jan-2012 nwhitehorn

Experimental support for booting CHRP-type PowerPC systems from hard disks.


# 230064 13-Jan-2012 truckman

Allow an MBR primary or extended Linux swap partition to be specified
as the system dump device. This was already allowed for GPT. The Linux
swap metadata at the beginning of the partition should not be disturbed
because the crash dump is written at the end.

Reviewed by: alfred, pjd, marcel
MFC after: 2 weeks


# 223587 27-Jun-2011 ae

MS Windows NT+ uses 4 bytes at offset 0x1b8 in the MBR to identify
disk drive. The boot0cfg(8) utility preserves these 4 bytes when is
writing bootcode to keep a multiboot ability.
Change gpart's bootcode method to keep DSN if it is not zero. Also
do not allow writing bootcode with size not equal to MBRSIZE.

PR: kern/157819
Tested by: Eir Nym
MFC after: 1 month


# 222341 27-May-2011 ae

Some partitioning tools may have a different opinion about disk
geometry and partitions may start from withing the first track.
If we found such partitions, then do not reserve space of the
first track, only first sector.


# 222279 25-May-2011 ae

Do not truncate available disk space to the closest track boundary.


# 222243 24-May-2011 ae

Remove unused variable.

MFC after: 1 week


# 221647 08-May-2011 ae

Replace UINT_MAX to UINT32_MAX.

Pointed out by: kib
MFC after: 1 week


# 221644 08-May-2011 ae

Limit number of sectors that can be addressed.

MFC after: 1 week


# 219029 25-Feb-2011 netchild

Add some FEATURE macros for various GEOM classes.

No FreeBSD version bump, the userland application to query the features will
be committed last and can serve as an indication of the availablility if
needed.

Sponsored by: Google Summer of Code 2010
Submitted by: kibab
Reviewed by: silence on geom@ during 2 weeks
X-MFC after: to be determined in last commit with code from this project


# 218014 28-Jan-2011 ae

Add new user-friendly aliases for partition types for the MBR and
EBR schemes: fat32, ebr, linux-data, linux-raid, linux-swap and
linux-lvm. Add bios-boot GUID and alias for the GPT scheme. It used by
GRUB 2 loader. Also do sorting definitions of types in diskmbr.h
and in g_part.c.

PR: bin/120990, kern/147664
MFC after: 2 weeks


# 216269 07-Dec-2010 brucec

Don't warn if a partition appears not to be aligned on a track boundary.
Modern disks use LBA and create a fake CHS geometry that doesn't have any
relation to the on-disk layout of data.


# 213769 13-Oct-2010 rpaulo

The canonical way to print __func__ when using KASSERT() is to write
("%s", __func__). This avoids clang's -Wformat-string warnings.


# 213174 25-Sep-2010 ae

Some schemes can allocate memory for internal purposes but when
GEOM does withering this memory doesn't freed. Add G_PART_DESTROY
call to g_part_wither. Also add missed g_free() call to G_PART_READ
method for MBR and PC98 schemes.

Submitted by: jh (previous version)
Reviewed by: pjd
Approved by: kib (mentor)


# 209536 26-Jun-2010 rpaulo

Add NTFS partition type to GEOM_MBR.


# 207094 23-Apr-2010 marcel

Implement the resize verb and add support for resizing partitions
for all schemes but EBR. Quality work by Andrey!

Submitted by: "Andrey V. Elsukov" <bu7cher@yandex.ru>


# 190536 30-Mar-2009 marcel

Sharpen the saw:
o MBR uses 32-bit block numbers. Limit the scheme to 2^32-1
blocks when the media is larger.


# 188354 09-Feb-2009 marcel

Add the EBR scheme. The EBR scheme supports the Extended Boot Records
found inside extended partitions and used to create logical partitions.
At this time write/modify support is not (yet) present.
The EBR and MBR schemes both check the parent scheme. The MBR will
back-off when nested under another MBR, whereas the EBR only nests
under a MBR.


# 188303 08-Feb-2009 imp

Fix g_part_*dumpconf to return void to match kobj definition.
Fix g_part_*name to return a const char * rather than a char *.


# 185497 01-Dec-2008 marcel

Allow boot code to be smaller than what the scheme expects.
This effectively changes the boot code size to be an upper
bound and makes the interface more flexible.


# 179853 18-Jun-2008 marcel

Add the set and unset verbs used to set and clear attributes for
partition entries. Implement the setunset method for the MBR
scheme to control the active flag.


# 179752 12-Jun-2008 marcel

Add the raw partition type to the XML.


# 178444 23-Apr-2008 marcel

Implement the G_PART_DUMPCONF method for all 6 schemes. Also call
the method for the (indent == NULL) case (i.e. the kern.geom.conftxt
sysctl). The purpose is to extend the conftxt output with scheme-
specific fields which can be used by libdisk. In particular, have
the schemes dump the xs and xt fields, which contain the backward
compatible values for class type and partition type. This allows
libdisk to work with the legacy slicers as well as with gpart and
helps/promotes migration.


# 178180 13-Apr-2008 marcel

Add the bootcode verb for installing boot code. Boot code
is supported for the MBR, GPT and PC98 schemes, where GPT
installs boot code into the PMBR.


# 177510 23-Mar-2008 marcel

Redefine G_PART_SCHEME_DECLARE() from populating a private linker set
to declaring a proper module. The module event handler is part of the
gpart core and will add the scheme to an internal list on module load
and will remove the scheme from the internal list on module unload.
This makes it possible to dynamically load and unload partitioning
schemes.


# 176672 29-Feb-2008 marcel

Follow-up improvements to the handling of false positives: If the
partition table is empty, check to see if we have something that
looks sufficiently like a BPB. On non-i386 machines, the boot
sector typically doesn't contain boot code; the end of the boot
sector is all zeroes. This is also where the partition table is
for MBRs.
We only check the sector size and cluster size, as that seems to
be the most reliable across implementations, BPB versions and
platforms.


# 176650 28-Feb-2008 marcel

Better handle false positives. The MBR differs from the boot sector
only because there's a partition table where the boot sector has
boot code. Boot sectors without boot code look like a MBR for all
practical purposes. This change adds a check for the partition table
and fails the probe when it's obvously invalid. The assumption being
that the sector contains a boot sector and not a MBR.
More checks are needed to distinguish a boot secto without boot code
from a (empty) MBR.


# 170897 17-Jun-2007 marcel

Have gpart synthesize a disk geometry if the underlying provider
don't have it. Some partitioning schemes, as well as file systems,
operate on the geometry and without it such schemes (e.g. MBR)
and file systems (e.g. FAT) can't be created. This is useful for
memory disks.


# 170651 13-Jun-2007 marcel

Add the MBR partitioning scheme to g_part. This does not yet
support the ability to install boot code.