Commit Graph

541 Commits

Author SHA1 Message Date
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
Brian Somers
044bf69fd5 Add a geli resize subcommand to resize encrypted filesystems prior
to growing the filesystem.

Refuse to attach providers where the metadata provider size is
wrong.  This makes post-boot attaches behave consistently with
pre-boot attaches.  Also refuse to restore metadata to a provider
of the wrong size without the new -f switch.  The new -f switch
forces the metadata restoration despite the provider size, and
updates the provider size in the restored metadata to the correct
value.

Helped by:	pjd
Reviewed by:	pjd
2010-09-20 22:04:59 +00:00
Pawel Jakub Dawidek
e38060039e Fix indent. 2010-09-19 10:51:55 +00:00
Pawel Jakub Dawidek
b5b293e37a GPART_PARAM_INDEX is now G_TYPE_NUMBER. 2010-09-15 21:37:26 +00:00
Pawel Jakub Dawidek
628ec6d344 Remove dead code. 2010-09-14 20:54:22 +00:00
Pawel Jakub Dawidek
fa5383a260 Remove now unused G_TYPE_ASCNUM. 2010-09-14 16:22:22 +00:00
Pawel Jakub Dawidek
8107ecf892 - Change all places where G_TYPE_ASCNUM is used to G_TYPE_NUMBER.
It turns out the new type wasn't really needed.
- Reorganize code a little bit.
2010-09-14 16:21:13 +00:00
Pawel Jakub Dawidek
56382b5f76 Update two last places where "arg0" should be used instead of "geom". 2010-09-14 16:19:09 +00:00
Pawel Jakub Dawidek
d1db39d90e All gpart(8) subcommands apart from the 'bootcode' subcommand handle
given geom/provider names with and without /dev/ prefix. Teach the
'bootcode' subcommand to handle /dev/<foo> names as well.
2010-09-14 11:36:26 +00:00
Pawel Jakub Dawidek
f104beb787 Remove dot which shouldn't be here, as err(3) will attach error message
at the end of the string.
2010-09-14 11:19:21 +00:00
Pawel Jakub Dawidek
7648b1e9c0 Introduce special G_VAL_OPTIONAL define, which when given in value field
tells geom(8) to ignore it when it is not given and don't try to obtain
default value.
2010-09-14 11:13:46 +00:00
Pawel Jakub Dawidek
315fcbf7db Add G_TYPE_MULTI flag, which when set for the given option, will
allow the option to be specified multiple times. This will help to
implement things like passing multiple keyfiles to geli(8) instead of
cat(1)ing them all into stdin and reading from there using one '-k -'
option.
2010-09-13 13:59:28 +00:00
Pawel Jakub Dawidek
946e2f3595 - Remove gc_argname field. It was introduced for gpart(8), but if I
understand everything correctly, we don't really need it.
- Provide default numeric value as strings. This allows to simplify
  a lot of code.
- Bump version number.
2010-09-13 13:48:18 +00:00
Pawel Jakub Dawidek
a478ea7490 - Allow to specify value as const pointers.
- Make optional string values always an empty string.
2010-09-13 08:56:07 +00:00
Maxim Konovalov
2888756701 o List MOUNTVER and SCHED classes. X-ref gsched(8). Bump Dd.
PR:		docs/149925
Submitted by:	arundel
2010-09-01 08:32:40 +00:00
Ulrich Spörlein
b2d89ed701 gsched(8): fix example usage, mdoc nits
- ad0 was referred to as da0
- wrong parameter -s instead of -a in example
- use double quotes consistently

PR:            docs/150082
Submitted by:  N.J. Mann <njm@njm.me.uk>
MFC after:     2 weeks
2010-08-29 11:32:41 +00:00
Dag-Erling Smørgrav
35efcc8b69 expand_number(3) takes a uint64_t * now; intmax_t was never correct
except by accident.

MFC after:	3 weeks
2010-08-19 11:20:24 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Matt Jacob
e02616caf0 Avoid a memory leak.
Submitted by:	Dmitry Luhtionov via Alexander Motin
MFC after:	1 week
2010-08-13 15:17:19 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Ulrich Spörlein
06d85cc61f gsched(8) was first released with FreeBSD 8.1
MFC after:	3 days
2010-07-30 12:56:34 +00:00
Benedict Reuschling
629ce700d5 Small typo fix: s/ommited/omitted
PR:             docs/148977
Submitted by:   Warren Block (wblock at wonkity dot com)
MFC after:      4 days
2010-07-27 17:23:40 +00:00
Andrey V. Elsukov
959059ef9e Document that SI unit suffixes are supported for -b and -s options
of add verb. Mention about maximum size limit for "freebsd-boot"
partition. It should be smaller than 545 KB (hardcoded in pmbr).
Show usage of SI unit suffixes in example.

Approved by:	mav (mentor)
MFC after:	1 week
2010-07-23 11:00:43 +00:00
Alexander Motin
bb160d3d4b Do not bzero() NULL pointer on malloc() error.
Submitted by:	Dmitry Luhtionov
2010-07-14 15:14:00 +00:00
Matt Jacob
5d8d4137df Fix the clear function which has been broken for a bit.
MFC after:	1 week
2010-07-04 22:17:56 +00:00
Andrey V. Elsukov
02fc66090b Check for overflow before it occurs. Also add check for
negative numbers.

Suggested by:	ache
Approved by:	kib (mentor)
2010-06-21 12:50:54 +00:00
Andrey V. Elsukov
79d89bb0ab Remove G_TYPE_ASCLBA type and replace it with G_TYPE_STRING in gpart.
Move code that converts params from humanized numbers to sectors count
to subr.c and adjust comment.
Add post-processing for "size" and "start offset" params in gpart,
now they are properly converted to sectors count with known sector size
that can be greater that 512 bytes.
Also replace "unsigned long long" type to "off_t" for unify code since
it used for medium size in libgeom(3) and DIOCGMEDIASIZE ioctl.

PR:		bin/146277
Reviewed by:	marcel (previous version)
Approved by:	kib (mentor)
MFC after:	1 month
2010-06-21 08:24:50 +00:00
Ulrich Spörlein
9eecb5528b mdoc nitpicking for gsched.8
- remove stray argument [1]
- remove stray whitespace
- use canonical wording for the HISTORY section

PR:		docs/147119 [1]
Submitted by:	Alexander Best <alexbestms@wwu.de> [1]
MFC after:	1 week
2010-06-19 18:52:37 +00:00
Andrey V. Elsukov
24609c49ca bgeom(3) does strdup of param name.
Don't leak memory when deleting param from gctl_req.

Reviewed by:	marcel
Approved by:	mav (mentor)
MFC after:	2 weeks
2010-06-07 07:41:41 +00:00
Marius Strobl
a7d366e958 - Mention that VTOC8 labels are found in Fujitsu SPARC64 machines as well.
- Add information regarding VTOC8 bootrstrap code and how it's handled with
  r208777 in place.
- Document the mapping of partition types to VTOC8 tags.
- Add examples for VTOC8 to the respective section.
- Eliminated hard sentence breaks.

Reviewed by:	marcel (slightly buggy version)
MFC after:	3 days
2010-06-03 13:04:56 +00:00
Marius Strobl
094fcb157d - In gpart_bootfile_read() fix an off-by-one error preventing the bootstrap
file to be of maximum size.
- Add special handling required for SMI/VTOC8 disklabel partcode, i.e. avoid
  overwriting the label when writing the bootstrap code to the partition
  starting at 0 and install it to all partitions when the -i option is omitted
  just like geom_sunlabel(4) and sunlabel(8) do by default.
- Add missing prototypes.
- Add const where applicable.

Reviewed by:	marcel
MFC after:	3 days
2010-06-03 13:01:55 +00:00
Nathan Whitehorn
0532c3a5a5 Teach gpart about bootcode on APM. 2010-05-16 22:21:33 +00:00
Marcel Moolenaar
665a080d71 Add and describe GEOM_PART_EBR. 2010-04-23 03:37:39 +00:00
Marcel Moolenaar
783310e6d9 Implement the resize command for resizing partitions. Without new
size, the partition in question is resized to fill all available
space. Quality work by Andrey!

Submitted by:	"Andrey V. Elsukov" <bu7cher@yandex.ru>
2010-04-23 03:14:04 +00:00
Pawel Jakub Dawidek
54ddff9dfa Flush disk write cache after storing and clearing metadata. 2010-04-15 16:35:34 +00:00