Commit Graph

575 Commits

Author SHA1 Message Date
Andrey V. Elsukov
ae3bc0acff Add an ability to stop gmirror and clear its metadata in one command.
This fixes the problem, when gmirror starts again just after stop.

The problem occurs when gmirror's component has geom label with equal size.
E.g. gpt and gptid have the same size as partition, diskid has the same
size as entire disk. When gmirror's geom has been destroyed, glabel
creates its providers and this initiate retaste.

Now "gmirror destroy" command is available. It destroys geom and also
erases gmirror's metadata.

MFC after:	2 weeks
2013-12-27 02:43:53 +00:00
Andrey V. Elsukov
32cea4ca0f Add "resize" verb to gmirror(8) and such functionality to geom_mirror(4).
Now it is easy to expand the size of the mirror when all its components
are replaced. Also add g_resize method to geom_mirror class. It will write
updated metadata to new last sector, when parent provider is resized.

Silence from:	geom@
MFC after:	1 month
2013-11-19 22:55:17 +00:00
Alan Somers
86b2e94a3d sbin/geom/class/part/geom_part.c
Always validate the return of find_geomcfg().  It could be NULL, for
	example when the geom is withering.

Approved by:	ken (mentor)
Sponsored by:	Spectra Logic Corporation
MFC after:	3 weeks
2013-10-23 18:58:11 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Sergey Kandaurov
05d98029e9 Sweep man pages replacing ad -> ada.
Approved by:	re (blackend)
MFC after:	1 week
X-MFC note:	stable/9 only
2013-10-01 18:41:53 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Chris Rees
454283379f Note NULL encryption method for GELI
PR:		docs/180551
Submitted by:	r4721@tormail.org
Approved by:	gjb (mentor)
2013-08-05 10:38:34 +00:00
Warren Block
42c916d7ee Add a new gptboot(8) man page. Factor out the redundant information
in gpart(8) and boot(8), adding references to gptboot(8) in both.

Reviewed by:	jhb, ae, pjd, Paul Schenkeveld <bsdcan@psconsult.nl>, david_a_bright@dell.com (portions), gjb
MFC after:	1 week
2013-07-01 22:38:36 +00:00
Marcel Moolenaar
3bd22a9cc8 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.
2013-06-09 23:34:26 +00:00
Joel Dahl
6c4b7d71f1 Minor clarificiation.
PR:		177455
2013-04-22 17:38:26 +00:00
Ed Schouten
7e659f9491 Add the Clang specific -Wmissing-variable-declarations to WARNS=6.
This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on:	toolchain@
2013-04-19 19:45:00 +00:00
John-Mark Gurney
a9fab404d4 update information about debugging sysctl...
MFC after:	1 week
2013-04-14 16:20:25 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Joel Dahl
50b476b034 Remove kernel options from the SYNOPSIS. They are already documented in the
geom(4) manual page SYNOPSIS.
2013-04-11 18:02:42 +00:00
Joel Dahl
6998737d06 Minor rewording.
Discussed with:	mav
2013-04-04 10:26:09 +00:00
Joel Dahl
af9fc0b09c Remove references to ataraid(4) and atacontrol(8). 2013-04-04 08:45:37 +00:00
Maxim Konovalov
cd08290b48 o Typo: IEE -> IEEE.
PR:		docs/173069
Submitted by:	Bjorn Heidotting
MFC after:	1 week
2013-03-25 12:38:45 +00:00
Pawel Jakub Dawidek
a3d8ae5d2d Reduce stack usage. 2013-03-18 21:11:31 +00:00
Joel Dahl
d1cd5e7cf3 Cross-reference gvinum(8) instead of vinum(8). 2013-03-16 22:02:47 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Sean Bruno
bd9fba0cfe Add legacy support to geom raid to create a /dev/arX device for support
of upgrading older machines using ataraid(4) to newer releases.

This optional parameter is controlled via kern.geom.raid.legacy_aliases
and will create a /dev/ar0 device that will point at /dev/raid/r0 for
example.

Tested on Dell SC 1425 DDF-1 format software raid controllers installing from
stable/7 and upgrading to stable/9 without having to adjust /etc/fstab

Reviewed by:	mav
Obtained from:	Yahoo!
MFC after:	2 Weeks
2013-03-08 20:07:32 +00:00
Benno Rice
085c638420 Fix typo in EFI GPT GUID. 2013-02-27 03:43:16 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Pawel Jakub Dawidek
b93ca95c4f Fix minor memory leak. 2013-02-10 15:56:47 +00:00
Pawel Jakub Dawidek
2d4b50b61e Assert that if we are not dealing with keyfile we are dealing with passfile. 2013-02-10 15:56:20 +00:00
Pawel Jakub Dawidek
d4e5fe17e6 Use arc4random_buf(3) instead of reimplementing it. 2013-02-10 15:55:42 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Warren Block
0e0d13226c Expand description of how gptboot and gptzfsboot choose a partition for
booting.

Reviewed by:	ae
MFC after:	1 week
2013-01-25 16:33:00 +00:00
Alexander Motin
821a0f639e For Promise/AMD metadata add support for disks with capacity above 2TiB
and for volumes with sector size above 512 bytes.
2013-01-17 00:50:25 +00:00
Alexander Motin
2c6a273750 Allow to insert new component to geom_raid3 without specifying number.
PR:		kern/160562
MFC after:	2 weeks
2013-01-15 10:06:35 +00:00
Konstantin Belousov
7c3b94cfea Use tabs for indentation.
MFC after:	2 weeks
2013-01-05 21:52:38 +00:00
Konstantin Belousov
2dd807c56e Do not round up the size of the UFS filesystem to the fragment size
when comparing its size with the size of the media, to determine if
the last disk block is unused.

Submitted by:	Andreas Longwitz <longwitz@incore.de>
Reviewed by:	pjd
MFC after:	2 weeks
2013-01-05 21:42:14 +00:00
Warren Block
fa7aed6c87 Document the output of the show command. Modified version of patch
provided by Bas Smeelen <b.smeelen@ose.nl>.  Use of 'gpart list'
suggested by by Andrey V. Elsukov <ae@FreeBSD.org>.

PR:		docs/174270
Submitted by:	Ronald F.Guilmette <rfg@tristatelogic.com>
Reviewed by:	ae (block sizes)
MFC after:	1 week
2013-01-03 21:58:28 +00:00
Simon J. Gerraty
7cd2dcf076 Updated/new Makefile.depend 2012-11-08 21:24:17 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
bf70becee6 More -Wmissing-variable-declarations fixes.
In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
2012-10-19 14:49:42 +00:00
Alexander Motin
c89d2fbe18 Add global and per-module sysctls/tunables to enable/disable metadata taste.
That should help to handle some cases when disk has some RAID metadata that
should be ignored, especially during boot.

MFC after:	3 days
2012-09-13 13:27:09 +00:00
Dag-Erling Smørgrav
5454cb96ef Change the gptboot example so the boot partition is aligned on a 4 kB
boundary.

MFC after:	3 days
2012-08-29 15:18:56 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Jim Harris
ad8131190f Document "destroy" as an alias for "stop". 2012-08-03 20:30:40 +00:00
Thomas Quinot
71ee4ef0d9 New command "gmultipath prefer" to force selection of a specified
provider in an Active/Passive configuration.

Reviewed by:	mav
MFC after:	4 weeks
2012-08-03 14:55:35 +00:00
Joel Dahl
72a1e3395c Remove trailing whitespace. 2012-07-30 10:14:37 +00:00
Isabell Long
3dd75dbc2b The ad(4) driver no longer exists in FreeBSD CURRENT or 9, so change the
references to it in gsched(8) to the existing ada(4) driver.

PR:		docs/170085
Submitted by:	olgeni
Approved by:	gavin
MFC after:	5 days
2012-07-26 17:30:34 +00:00
Pawel Jakub Dawidek
a894d53ea0 Improve description of various key used by GELI.
PR:		docs/169089
Submitted by:	John W. O'Brien <john@saltant.com>
MFC after:	3 days
2012-07-04 17:59:26 +00:00
Warren Block
77b722fce4 Use possessive "its", no apostrophe.
MFC after:	1 day
2012-06-27 01:44:48 +00:00
Warren Block
344c81a166 Fixes to man8 groff mandoc style, usage mistakes, or typos.
PR:		168016
Submitted by:	Nobuyuki Koganemaru
Approved by:	gjb
MFC after:	3 days
2012-05-24 02:24:03 +00:00
Eitan Adler
af23b88b5c Clarify error that geli generates
when it finds corrupt data.

PR:		kern/165695
Submitted by:	Robert Simmons <rsimmons0@gmail.com>
Reviewed by:	pjd
Approved by:	cperciva
MFC after:	1 week
2012-05-09 17:26:52 +00:00
Alexander Motin
8f12ca2ee1 Add support for RAID5R. Slightly improve support for RAIDMDF. 2012-05-06 11:32:36 +00:00
Alexander Motin
e231bbbaa3 Add description for GEOM RAID tunables/sysctls.
MFC after:	1 week
2012-05-06 06:25:17 +00:00
Andrey V. Elsukov
ceeac1ac05 Don't ignore start offset value when user specifies it together
with alignment.

PR:		bin/167567
Tested by:	Warren Block
MFC after:	1 week
2012-05-04 19:49:24 +00:00
Alexander Motin
4b97ff6137 Implement read-only support for volumes in optimal state (without using
redundancy) for the following RAID levels: RAID4/5E/5EE/6/MDF.
2012-05-04 07:32:57 +00:00
Alexander Motin
8df8e26adc Add optional -o argument to the graid label to specify some metadata
format options. Use it for specifying byte order for the DDF metadata:
big-endian defined by specification and little-endian used by Adaptec.
2012-05-03 05:32:56 +00:00
Alexander Motin
00f32ecbd0 Add to GEOM RAID class module, supporting the DDF metadata format, as
defined by the SNIA Common RAID Disk Data Format Specification v2.0.

Supports multiple volumes per array and multiple partitions per disk.
Supports standard big-endian and Adaptec's little-endian byte ordering.
Supports all single-layer RAID levels. Dual-layer RAID levels except
RAID10 are not supported now because of GEOM RAID design limitations.

Some work is still to be done, but the present code already manages basic
interoperation with RAID BIOS of the Adaptec 1430SA SATA RAID controller.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2012-04-30 17:53:02 +00:00
Glen Barber
64cc18cc01 As of r226840, GELI starts one thread per CPU.
PR:		167382
Submitted by:	John W. O'Brien (john%saltant.com)
X-Needs-MFC:	r226840
2012-04-28 20:23:13 +00:00
Alexander Motin
fc1de96060 Add to GEOM RAID class module for reading non-degraded RAID5 volumes and
some environment to differentiate 4 possible RAID5 on-disk layouts.

Tested with Intel and AMD RAID BIOSes.

MFC after:	2 weeks
2012-04-19 12:30:12 +00:00
Alexander Motin
63297dfd4a Some improvements to GEOM MULTIPATH:
- Implement "configure" command to allow switching operation mode of
running device on-fly without destroying and recreation.
 - Implement Active/Read mode as hybrid of Active/Active and Active/Passive.
In this mode all paths not marked FAIL may handle reads same time,
but unlike Active/Active only one path handles write requests at any
point in time. It allows to closer follow original write request order
if above layers need it for data consistency (not waiting for requisite
write completion before sending dependent write).
 - Hide duplicate messages about device status change.
 - Remove periodic thread wake up with 10Hz rate.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2012-04-18 09:42:14 +00:00
Joel Dahl
091eeb4841 Remove superfluous paragraph macro. 2012-03-25 09:21:09 +00:00
Andrey V. Elsukov
8da4c41364 Document GEOM_PART_LDM scheme and partition types.
MFC after:	1 month
2012-03-19 13:17:47 +00:00
Eitan Adler
c0f0c9848e Fix a variety of grammar issues and style nits.
PR:		docs/165668
Submitted by:	Robert Simmons <rsimmons0@gmail.com>
Reviewed by:	kaduk@mit.edu
Approved by:	cperciva
MFC after:	1 week
2012-03-04 16:37:44 +00:00
Eitan Adler
5bfdf7f990 Remove reference to gsched_as module, which doesn't
actually exist.

PR:		docs/163043
Submitted by:	olgeni
Approved by:	brd
MFC after:	3 days
2012-02-22 04:51:17 +00:00
Dag-Erling Smørgrav
08a478a8e9 Provide a better explanation for the sizing of the boot partition, and
reduce the size of the partition in the example from 128 blocks to 94
blocks so it will end on a 128-block boundary.  Also remove the -b
option from the next example.

MFC after:	3 weeks
2012-01-13 12:40:33 +00:00
Eitan Adler
4417a80129 Fix warning when compiling with gcc46:
error: variable 'secsz' set but not used

Reviewed by:	ae
Approved by:	dim
MFC after:	3 days
2012-01-10 02:59:35 +00:00
Jim Harris
c1ad3fcf6a Add support for >2TB disks in GEOM RAID for Intel metadata format.
Reviewed by: mav
Approved by: scottl
MFC after: 1 week
2012-01-09 23:01:42 +00:00
Warren Block
691d77364e Whitespace-only fix. Translators, please feel free to ignore.
Approved by:	gjb (mentor)
MFC after:	3 days
X-MFC-with:	r227774, r227777, r227800
2012-01-09 05:51:33 +00:00
Warren Block
cc2b96dd32 Clarity improvements.
Approved by:	gjb (mentor)
MFC after:	3 days
2012-01-09 04:27:32 +00:00
Warren Block
c05923c2a0 Correct and expand BSD partitioning scheme description.
Correct GUID to GPT in RECOVERING section.

Reviewed by:	ae
Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 18:04:37 +00:00
Warren Block
292271d4c0 Fix date.
Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 02:03:18 +00:00
Warren Block
97982fcc82 Add a section that explicitly describes partitioning schemes. Modify
existing sections to refer to the new one.  Rearrange partitioning scheme
list so MBR and EBR types are together.  Also add several corrections for
grammar, clarity, and consistency.

Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 00:02:49 +00:00
Alexander Motin
1446ecce65 Fix build on some archs after r227464. 2011-11-12 20:01:30 +00:00
Dimitry Andric
59cfaa640c Fix buildworld breakage due after r227464.
Pointy hat to:	mav
2011-11-12 19:45:56 +00:00
Alexander Motin
0c883cef45 Major GEOM MULTIPATH class rewrite:
- Improved locking and destruction process to fix crashes.
 - Improved "automatic" configuration method to make it consistent and safe
by reading metadata back from all specified paths after writing to one.
 - Added provider size check to reduce chance of ordering conflict with
other GEOM classes.
 - Added "manual" configuration method without using on-disk metadata.
 - Added "add" and "remove" commands to allow manage paths manually.
 - Failed paths are no longer dropped from geom, but only marked as FAIL
and excluded from I/O operations.
 - Automatically restore failed paths when all others paths are marked
as failed, for example, because of device-caused (not transport) errors.
 - Added "fail" and "restore" commands to manually control FAIL flag.
 - geom is now destroyed on last path disconnection.
 - Added optional Active/Active mode support. Unlike Active/Passive
mode, load evenly distributed between all working paths. If supported by
the device, it allows to significantly improve performance, utilizing
bandwidth of all paths. It is controlled by -A option during creation.
Disabled by default now.
 - Improved `status` and `list` commands output.

Sponsored by:	iXsystems, inc.
MFC after:	1 month
2011-11-12 09:52:27 +00:00
Alexander Motin
733a1f3f52 Clarify disks/volumes above 2TiB support in geom_raid:
- add support for volumes above 2TiB with Promise metadata format;
 - enforse and document other limitations:
   - Intel and Promise metadata formats do not support disks above 2TiB;
   - NVIDIA metadata format does not support volumes above 2TiB.

Sponsored by:	iXsystems, Inc.
MFC after:	2 weeks
2011-10-26 21:50:10 +00:00
Pawel Jakub Dawidek
1f8c92e6fa Add support for creating GELI devices with older metadata version for use
with older FreeBSD versions:
- Add -V option to 'geli init' to specify version number. If no -V is given
  the most recent version is used.
- If -V is given don't allow to use features not supported by this version.
- Print version in 'geli list' output.
- Update manual page and add table describing which GELI version is
  supported by which FreeBSD version, so one can use it when preparing GELI
  device for older FreeBSD version.

Inspired by:	Garrett Cooper <yanegomi@gmail.com>
MFC after:	3 days
2011-10-25 13:57:50 +00:00
Pawel Jakub Dawidek
ef055009c2 Add 'geli version' subcommand, which will print GELI metadata version of each
given GEOM provider or if not providers are given it will print versions
supported by userland geli(8) utility and by ELI GEOM class.

MFC after:	3 days
2011-10-25 08:03:51 +00:00
Pawel Jakub Dawidek
3bddbd0f3b When we detect GELI metadata version that is newer than the highest we
support, inform the user about that instead of 'MD5 hash mismatch'.

Suggested by:	Garrett Cooper <yanegomi@gmail.com>
MFC after:	3 days
2011-10-25 07:56:27 +00:00
Pawel Jakub Dawidek
79e6fcac83 Simplify eli_resize() function.
MFC after:	3 days
2011-10-25 07:44:10 +00:00
Pawel Jakub Dawidek
f1a465000f Simplify eli_dump() function and allow to dump metadata stored in backup file.
MFC after:	3 days
2011-10-25 07:37:02 +00:00
Pawel Jakub Dawidek
275ae453d6 If 'req' is NULL, print error on stderr.
MFC after:	3 days
2011-10-25 07:34:35 +00:00
Pawel Jakub Dawidek
c99a654256 Simplify eli_is_attached() function and make it return boot instead of int.
MFC after:	3 days
2011-10-25 07:32:43 +00:00
Pawel Jakub Dawidek
34c4866250 Simplify eli_backup_create() and eli_backup_restore() functions.
As a side-effect it is now possible to backup unsupported (newer)
GELI metadata versions.

MFC after:	3 days
2011-10-25 07:31:13 +00:00
Pawel Jakub Dawidek
3ab01ecf56 Sort includes.
MFC after:	3 days
2011-10-25 07:24:51 +00:00
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Andrey V. Elsukov
6a0a87741b Don't use the whole free space when resizing partition to a larger size
on a disk with non zero stripesize (e.g. disks with 4k sector size)[1].
Also do not use automatic alignment when size is exactly specified, but
an alignment is not. Use automatic alignment only for case when user
omits both "-s" and "-a" options.

Reported by:	Mikael Fridh <frimik at gmail> [1]
Approved by:	re (kib)
MFC after:	1 week
2011-09-08 04:14:16 +00:00
Andrey V. Elsukov
25b233372d o Fix mdoc formatting for the '.Fx' macro. [1]
o Add information about APM scheme and fix typos. [2]

Submitted by:	gjb [1], nwhitehorn [2]
Approved by:	re (kib)
MFC after:	1 week
2011-08-20 08:20:10 +00:00
Andrey V. Elsukov
15d837d8a0 Add new section "BOOTSTRAPPING" to the gpart(8), that describes
bootstrap code images used to boot from MBR, GPT, BSD and VTOC8
schemes.

Reviewed by:	marius (previous version)
Approved by:	re (kib)
MFC after:	1 week
2011-08-19 10:12:02 +00:00
Andrey V. Elsukov
8fb2868c61 When user specifies the bootcode with size smaller than VTOC_BOOTCODE,
gpart_write_partcode_vtoc8 does access out of range of allocated memory.
Check size of bootcode before writing it.

Pointed out by:		ru
MFC after:		1 week
2011-06-21 10:35:20 +00:00
Xin LI
4c82b916fc Mod the offset padding by alignment. Without this change we may
pad too much when underlying GEOM object have a zero stripesize.

MFC after:	1 month
2011-06-21 04:46:00 +00:00
Andrey V. Elsukov
621f3e6d9c The "size" param needs no adjusting to stripeoffset.
Reported by:	Kris Moore
2011-06-21 04:06:39 +00:00
Andrey V. Elsukov
beeca17d4c Add "alignment" param to the request before calling gpart_autofill(). 2011-06-16 19:42:03 +00:00
Andrey V. Elsukov
08892bf4bf Do not use LCM from stripesize and user specified alignment value.
When user wants have specific alignment - do what user wants.
Use stripesize as alignment value in case, when some of gpart's
arguments are ommitted for automatic calculation.

Suggested by:	mav
2011-06-07 11:11:11 +00:00
Gavin Atkinson
8a7fca58aa Rework parts of this man page to improve grammar.
Inspired by, and parts submitted by...
PR:		docs/157467
Submitted by:	Ben Kaduk <kaduk mit.edu>
MFC after:	2 weeks
2011-06-06 21:02:26 +00:00
Ed Schouten
48a16a34d8 Remove redundant assignments to WARNS.
For these directories, WARNS is already implied to be 6.
2011-06-06 20:24:17 +00:00
Ruslan Ermilov
8bf9aaabf9 Generally clean up markup. 2011-06-03 10:39:36 +00:00
Andrey V. Elsukov
57512b16ae Always use LCM when stripesize > 0. 2011-06-02 22:15:19 +00:00
Andrey V. Elsukov
a6c21ef2d1 Use stripesize and stripeoffset in the automatic calculation of
partition offsets. If user requests specific alignment and
provider's stripesize is not zero, then use a least common multiple
from the stripesize and user specified value.
Also fix "gpart resize" implementation: do not try to align the partition
size, because the start offset may be not aligned. Instead align the
end offset and then calculate size. Also use stripesize and stripeoffset
for "gpart resize" command.
2011-06-02 21:59:21 +00:00
Ulrich Spörlein
b2e52ced25 mdoc: fix markup 2011-06-02 09:56:42 +00:00
Andrey V. Elsukov
6f5286dca6 Document kern.geom.part.check_integrity sysctl variable. 2011-05-30 11:17:42 +00:00
Andrey V. Elsukov
ca203c4faa Add example how to create MBR and BSD schemes and install boot code. 2011-05-27 15:29:39 +00:00
Andrey V. Elsukov
cbcc2a4fd6 Synchronize manpage's synopsis with program's usage. Since -l and -r
keys are mutually exclusive for the `gpart show` command, then mark
them so.

Requested by:	ru
2011-05-27 14:30:13 +00:00
Andrey V. Elsukov
53fb12dbef Simplify ALIGNDOWN macro. 2011-05-24 17:03:46 +00:00
Andrey V. Elsukov
72b066244c Fix calculation of alignment for odd values. Also do not change value
when it is already aligned.
2011-05-24 16:49:34 +00:00
Andrey V. Elsukov
6c7e04f0f3 Some partitioning schemes want to have partitions that are aligned
with geometry. And they do recalculation of user specified parameters.
MBR, PC98, VTOC8, EBR schemes are doing that. For these schemes an
auto alignment feature (ie. gpart add -a alignment) would not work.
But it can work for GPT and BSD schemes. BSD scheme usualy is created
inside MBR, so we can use knowledge about offset of MBR partition to
calculate aligned values for BSD partitions.

Use "offset" attribute of the parent provider for better alignment.

MFC after:	2 weeks
2011-05-15 16:16:48 +00:00
Andrey V. Elsukov
cb86ada75d Simplify the code a bit. For own providers GEOM_PART always provides
"start" and "end" config attributes.

MFC after:	1 week
2011-05-15 11:45:13 +00:00
Pawel Jakub Dawidek
1b93915ff2 Document the following sysctls:
kern.geom.eli.version
kern.geom.eli.key_cache_limit
kern.geom.eli.key_cache_hits
kern.geom.eli.key_cache_misses

MFC after:	1 week
2011-05-08 09:46:09 +00:00
Andrey V. Elsukov
d9711c28ef Add "-a alignment" option to gpart(8). When it specified gpart(8)
tries to align partition start offset and size to be multiple of
alignment value.

MFC after:	2 weeks
2011-05-03 07:33:39 +00:00
Alexander Motin
89b172238a MFgraid/head:
Add new RAID GEOM class, that is going to replace ataraid(4) in supporting
various BIOS-based software RAIDs. Unlike ataraid(4) this implementation
does not depend on legacy ata(4) subsystem and can be used with any disk
drivers, including new CAM-based ones (ahci(4), siis(4), mvs(4), ata(4)
with `options ATA_CAM`). To make code more readable and extensible, this
implementation follows modular design, including core part and two sets
of modules, implementing support for different metadata formats and RAID
levels.

Support for such popular metadata formats is now implemented:
Intel, JMicron, NVIDIA, Promise (also used by AMD/ATI) and SiliconImage.

Such RAID levels are now supported:
RAID0, RAID1, RAID1E, RAID10, SINGLE, CONCAT.

For any all of these RAID levels and metadata formats this class supports
full cycle of volume operations: reading, writing, creation, deletion,
disk removal and insertion, rebuilding, dirty shutdown detection
and resynchronization, bad sector recovery, faulty disks tracking,
hot-spare disks. For Intel and Promise formats there is support multiple
volumes per disk set.

Look graid(8) manual page for additional details.

Co-authored by:	imp
Sponsored by:	Cisco Systems, Inc. and iXsystems, Inc.
2011-03-24 21:31:32 +00:00
Alexander Motin
83d165c127 MFgraid/head r217014:
Make `geom XXX list` and `geom XXX status` outputs more consistent:
Add -a options to print all geoms, not only ones with providers.
Add -g option for `status` to report geom's names, not provider's.
Make `status` by default report provider's status (if present), not geom's.
Make `status` report consumer's statuses, not only "synchronized" field.
2011-03-24 19:11:05 +00:00
Andrey V. Elsukov
12b536efc0 Fix grammar.
Pointed out:	Ben Kaduk
MFC after:	2 weeks
2011-03-12 21:51:56 +00:00
Andrey V. Elsukov
3ea4913310 Document GEOM_PART_EBR_COMPAT option.
MFC after:	2 weeks
2011-03-12 17:05:18 +00:00
Pawel Jakub Dawidek
7a9611bf5e Change example to not be controversial.
I'm sorry to anyone who felt offended by this.

PR:		docs/155385
Reported by:	maga_lena <mirto@riseup.net>
MFC after:	1 week
2011-03-09 07:43:51 +00:00
Andrey V. Elsukov
bd727a6884 It is better to sometimes have not aligned columns than
often have wrapped lines.

MFC after:	2 weeks
2011-03-08 22:01:47 +00:00
Andrey V. Elsukov
acefd268d6 Add -p option to gpart show command to show provider's names of
partitions instead of partition's indexes. This may be useful with
GPT partitioning scheme or EBR without GEOM_PART_EBR_COMPAT option.

MFC after:	2 weeks
2011-03-08 21:36:42 +00:00
Andrey V. Elsukov
219762ba49 Document the "bios-boot" partition type.
MFC after:	2 weeks
2011-01-28 11:56:14 +00:00
Ivan Voras
cf66069869 Added a blurb about thin provisioning, fixed some formatting. 2011-01-24 14:24:10 +00:00
Maxim Konovalov
9bd2cc2be5 o Somehow I revert Dd macro in the previous commit.
Re-revert it.
2011-01-13 06:20:44 +00:00
Maxim Konovalov
8f3d01269c o Start each sentence on a new line. No content changes.
Suggested by:	jhb
MFC after:	1 week
2011-01-13 06:18:00 +00:00
Maxim Konovalov
c521792b98 o Typo fixes.
PR:		docs/153933
Submitted by:	jpaetzel@, Warren Block
MFC after:	1 week
2011-01-13 06:10:47 +00:00
Rebecca Cran
7f903d33f0 Fix formatting of cross-references. 2011-01-12 23:31:28 +00:00
Rebecca Cran
9b6c99e835 Fix sorting of cross-references. 2011-01-12 20:27:14 +00:00
Rebecca Cran
f70a74cc85 Fix cross-reference to gvinum(8). 2011-01-12 19:20:30 +00:00
Andrey V. Elsukov
1af759d93a Fix up the grammar.
PR:		docs/153933
MFC after:	3 days
2011-01-12 19:06:59 +00:00
Andrey V. Elsukov
95959703e1 Sector size can not be greater than MAXPHYS. Since GRAID3 calculates
sector size from user-specified block size, report to user about
big blocksize.

PR:		kern/147851
MFC after:	1 week
2011-01-12 13:55:01 +00:00
Andrey V. Elsukov
5c98f5b0da Check number of arguments before trying to read arg0. This prevents access
to arg0 and dumping core when `gpart bootcode` called without arguments.
2010-12-21 17:24:32 +00:00
David E. O'Brien
d8ca56cb98 Revert r216473.
WARNS=6 causes "warning: cast increases required alignment of target type"
on arm, ia64, mips, and sparc64.
2010-12-16 17:54:56 +00:00
David E. O'Brien
eed51a7443 Bump WARNS to 6. 2010-12-16 00:36:10 +00:00
David E. O'Brien
7ae53fe908 GEOM virstor .so does not need libmd. 2010-12-16 00:00:28 +00:00
David E. O'Brien
8494b7389a Rename the generic "CLASS" to the more specific "GEOM_CLASS".
While I'm here remove redundancy and inconsistencies.

Obtained from: Juniper Networks
2010-12-15 23:45:12 +00:00
David E. O'Brien
7838c4d1c1 Rename the generic "CLASS" to the more specific "GEOM_CLASS".
While I'm here remove redundancy and inconsistencies.

Obtained from: Juniper Networks
2010-12-15 23:24:34 +00:00
Xin LI
62ad217a9b * Recommend a overwrite of whole geli provider before use.
* Correct a typo while I'm there.

Reviewed by:	pjd
MFC after:	2 weeks
2010-12-03 10:06:19 +00:00
Rebecca Cran
1161d4202c Fix some more warnings found by clang. 2010-11-22 20:10:48 +00:00
Andrey V. Elsukov
68f7502341 Add SIGINT handler to gpart restore action.
MFC after:	1 week
2010-11-22 11:24:11 +00:00
Andrey V. Elsukov
80085938d4 Always dump partition labels with gpart backup, but gpart restore
does restore them only when -l option is specified [1]. Make number of
entries field in backup format optional. Document -l and -r options of
`gpart show` action.

Suggested by:	pjd [1]
MFC after:	1 week
2010-11-22 10:08:33 +00:00
Andrey V. Elsukov
9fe175f914 Add to gpart(8) an ability to backup partition table and
restore it from given backup.

Discussed with:	geom@
Approved by:	kib (mentor)
MFC after:	1 week
2010-11-20 16:03:53 +00:00
Pawel Jakub Dawidek
240dd5b5aa Use fprintf(stderr) instead of gctl_error() to print a warning about too
big sector size. When gctl error is set gctl_has_param() always returns
'false', which prevents geli(8) from finding some arguments and also masks
an error, which is generates in such case.

MFC after:	3 days
2010-10-26 22:46:15 +00:00
Andrey V. Elsukov
e7926a3703 Reimplemented "gpart destroy -F". Now it does all work in kernel.
This was needed for recover implementation.

Implement the recover command for GPT. Now GPT will marked as
corrupt when any of three types of corruption will be detected:
1. Damaged primary GPT header or table
2. Damaged secondary GPT header or table
3. Secondary header is not located in the last LBA
Marked GPT becomes read-only. Any changes with corrupt table
are prohibited. Only "destroy" and "recover" commands are allowed.

Discussed with:	geom@ (mostly silence)
Tested by:	Ilya A. Arhipov
Approved by:	mav (mentor)
MFC after:	2 weeks
2010-10-25 16:23:35 +00:00
Pawel Jakub Dawidek
5ad4a7c74a Bring in geli suspend/resume functionality (finally).
Before this change if you wanted to suspend your laptop and be sure that your
encryption keys are safe, you had to stop all processes that use file system
stored on encrypted device, unmount the file system and detach geli provider.

This isn't very handy. If you are a lucky user of a laptop where suspend/resume
actually works with FreeBSD (I'm not!) you most likely want to suspend your
laptop, because you don't want to start everything over again when you turn
your laptop back on.

And this is where geli suspend/resume steps in. When you execute:

	# geli suspend -a

geli will wait for all in-flight I/O requests, suspend new I/O requests, remove
all geli sensitive data from the kernel memory (like encryption keys) and will
wait for either 'geli resume' or 'geli detach'.

Now with no keys in memory you can suspend your laptop without stopping any
processes or unmounting any file systems.

When you resume your laptop you have to resume geli devices using 'geli resume'
command. You need to provide your passphrase, etc. again so the keys can be
restored and suspended I/O requests released.

Of course you need to remember that 'geli suspend' won't clear file system
cache and other places where data from your geli-encrypted file system might be
present. But to get rid of those stopping processes and unmounting file system
won't help either - you have to turn your laptop off. Be warned.

Also note, that suspending geli device which contains file system with geli
utility (or anything used by 'geli resume') is not very good idea, as you won't
be able to resume it - when you execute geli(8), the kernel will try to read it
and this read I/O request will be suspended.
2010-10-20 20:50:55 +00:00
Andrey V. Elsukov
21bf062e7e Replace strlen(_PATH_DEV) with sizeof(_PATH_DEV) - 1.
Suggested by:	kib
Approved by:	kib (mentor)
MFC after:	5 days
2010-10-09 20:20:27 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Pawel Jakub Dawidek
15d98d9738 Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.

Reviewed by:	simon, rpaulo
MFC after:	2 weeks
2010-09-28 09:07:00 +00:00
Andrey V. Elsukov
6259ffb455 Remove superfluous word from "gpart bootcode" usage message.
Approved by:	kib (mentor)
2010-09-26 21:48:32 +00:00
Pawel Jakub Dawidek
1cf3d5ee99 - Add support for loading passphrase from a file (-J and -j options).
This is especially useful for things like installers, where regular
  geli prompt can't be used.
- Add support for specifing multiple -K or -k options, so there is no
  need to cat all keyfiles and read them from standard input.

Requested by:	Kris Moore <kris@pcbsd.org>, thompsa
MFC after:	2 weeks
2010-09-25 17:38:57 +00:00
Andrey V. Elsukov
6305a96c20 Implement "force" (-F) option for gpart destroy verb.
This option doesn't passed to kernel and handled in user-space.
With -F option gpart creates new "delete" request for each
partition in table. Each request has flags="X" that disables
auto-commit feature. Last request is the original "destroy" request.
It has own flags and can have disabled or enabled auto-commit feature.
If error is occurred when deleting partitions, then new "undo" request
is created and all changes will be rolled back.

Approved by:	kib (mentor)
2010-09-24 08:40:43 +00:00
Pawel Jakub Dawidek
7157a8ad7d - Simplify code by using g_*() API.
- Don't use u_char and u_int in userland.
- Change 'unsigned' to 'unsigned int'.
- Update copyright years.

MFC after:	1 week
2010-09-23 12:04:12 +00:00
Pawel Jakub Dawidek
cdf8ab6198 Update copyright years.
MFC after:	1 week
2010-09-23 12:02:42 +00:00
Pawel Jakub Dawidek
07f1d01429 Document AES-XTS.
MFC after:	1 week
2010-09-23 12:00:40 +00:00
Pawel Jakub Dawidek
d2ac2ff105 - When trashing metadata, repeat overwrite kern.geom.eli.overwrites times.
- Flush write cache after each write.

MFC after:	1 week
2010-09-23 11:18:02 +00:00
Pawel Jakub Dawidek
488186c304 - Use g_*() API when doing backups.
- fsync() created filed.

MFC after:	1 week
2010-09-23 11:04:50 +00:00
Pawel Jakub Dawidek
2ecb2a01e7 Because we first write metadata into new place and then trash old place we
don't want situation where old size is equal to new size, as we will trash
newly written metadata.

MFC after:	1 week
2010-09-23 10:58:13 +00:00
Pawel Jakub Dawidek
429cf66400 - Make use of g_*() API.
- Flush cache after writing metadata.

MFC after:	1 week
2010-09-23 10:55:45 +00:00
Pawel Jakub Dawidek
5cd61a1fb7 Simplify code a bit by using g_*() API from libgeom.
MFC after:	1 week
2010-09-23 10:50:17 +00:00