Commit Graph

69 Commits

Author SHA1 Message Date
Poul-Henning Kamp
c0fdfdba29 Use default geometry in case the device doesn't provide one:
512 for sectorsize.
	63 for sectors.
	255 for heads.
This will mostly show up on MD(4) devices.
2003-03-29 22:06:52 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Poul-Henning Kamp
f353c761f7 Make fdisk work on active GEOM devices. 2002-12-29 15:17:11 +00:00
Poul-Henning Kamp
a8ad364a7f Fix the regexp evilness so that fdisk can (again?) find the device
root is on from the root mount path.

Spotted by:	imp
2002-10-27 10:52:54 +00:00
Poul-Henning Kamp
8b4d099d5f Don't attempt to find the geometry with disklabel based ioctl, it just
issues a useless warning now.
2002-10-27 10:33:38 +00:00
Poul-Henning Kamp
3bb24c35f2 Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:
Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h.

These two new copies are still intact copies of disklabel.h and
therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them
in programs which already include <sys.disklabel.h> is currently a
no-op.

This commit adds a number of such #includes.

Once I have verified that I have fixed all the places which need fixing,
I will commit the updated versions of the three #include files.

Sponsored by:   DARPA & NAI Labs.
2002-10-01 07:24:55 +00:00
Poul-Henning Kamp
7963fae61f Straighten out get_params().
Sponsored by:	DARPA & NAI Labs.
2002-09-20 08:12:51 +00:00
Poul-Henning Kamp
3f8ba8b5f8 Try to pick up disk geometry with specific DIOC* ioctls, rather than
expecting a bogo-disklabel to contain them, if possible.

This makes fdisk work with GEOM.
2002-09-15 16:08:52 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Bruce Evans
689fee8724 Fixed some print format errors. Avoid some warnings about possible
(but not actual) alignment problems.  Both of these bugs were detected
on ia64's and were fatal on ia64's due to premature setting of WARNS
to 4.
2002-07-16 23:18:29 +00:00
Peter Wemm
29ea697d8a Add a hack so that fdisk(8) can initialize an ia64 disk. There is
no /boot/mbr to read the boot code from (ia64 does not *have* bootblocks!).
fdisk depended on magic in the /boot/mbr file to initialize some fields.
2002-05-01 06:48:29 +00:00
Greg Lehey
1254a3ba7b Add partition type for IBM's JFS.
Submitted by:	Hiten Pandya <hiten@uk.FreeBSD.org>
2002-04-28 01:52:17 +00:00
Tom Rhodes
05a213f1e8 Fix the fdisk(8) manual page.
s/partition/slice/ in fdisk.8
fix a bug in fdisk(8) where it did not honer -t when using -I

PR:		36563 and 35688
Submitted by:	bde
Reviewed by:	bde
2002-04-18 16:25:18 +00:00
Poul-Henning Kamp
041b8b0058 Get this to WARNS=4 and closer to style(9) at a sacrifice in
linelength.
2002-03-29 19:33:14 +00:00
Josef Karthauser
978d3bfe9c Add some more partition types.
PR:		i386/14793
MFC after:	3 days
2002-02-18 19:32:38 +00:00
Ian Dowse
881c9063c7 Oops, the arguments to a bcopy() were reversed, which broke zeroing
of unused partition entries and later detection of unused entries.

Use memcpy to be consistent with the rest of the code, and fix a
minor style nit.

Submitted by:	bde
2001-12-30 18:51:51 +00:00
Bruce Evans
2175f5f1b9 Fixed spelling error in previous commit. 2001-10-16 10:52:12 +00:00
Peter Wemm
a528d3185a Add 0xEE (EFI GPT) and 0xEF (EFI System Partition) 2001-10-15 07:21:32 +00:00
Ian Dowse
6369218752 Fix a number of bugs and annoyances in fdisk, many of which were
pointed out by bde:
- Ask for user confirmation before adjusting to a head/cylinder
  boundary (only when running interactively), and separate this
  adjustment from the automatic calculation of c/h/s parameters.
- In sanitize_partition, don't change any values in the slice until
  we know that the automatic adjustment will succeed.
- When auto-adjusting, ignore unused slices and give an appropriate
  error for other zero-size slices depending on the cause.
- Change dos() to do all of the c/h/s calculations for a whole slice;
  this fixes a bug where the ending c/h/s of an unused slice was set
  incorrectly.
- When changing the active slice, detect the currently active slice
  number instead of always defaulting to slice 4.
- Call fflush(stdout) before calling fgets().
- Test for fgets() returning NULL so we don't loop on EOF.

Reviewed by:	bde
2001-08-05 16:24:13 +00:00
Joerg Wunsch
df77f711f3 After some (long-standing ;-) critics from Bruce, throw away the old
device search code i introduce nearly six years ago in rev 1.8.  Bruce
suggested to rather use the device name of the root filesystem instead
which is certainly the most sensible default.  Since there are many
possible cases for a root filesystem name (device with and without
slices, consider /dev/vinum/root even though it currently could not
work as such), there's some heuristic using a RE in order to find out
the canonical device name from the mounted name.  This probably won't
quite fit for a NFS root (can't test that right now), but then,
there's hard to find a good default for those machines anyway. ;-)

This unbreaks the functionality of rev 1.2 i once broke in 1.8. :)
2001-07-13 16:48:56 +00:00
Joerg Wunsch
8de9ed220e Make open_disk() fail nicely upon encountering an ENOENT so to not
prematurely terminate the search for a usable disk.  ENOENT is quite
normal in particulare now with the advent of devfs.

While being here, also remove /dev/wd0 and /dev/od0 from the list of
disks to search since we don't have them anymore.

MFC after:	1 week
2001-07-05 10:04:43 +00:00
David E. O'Brien
6580291ba4 I didn't maintain the "chs" ordering. Rather the bug was in print_part().
Requested by:	bde.
2000-11-29 20:22:47 +00:00
David E. O'Brien
0469c254fb Make the order of values prompted for with the "-i" option match print_part() 2000-11-18 02:55:43 +00:00
John Baldwin
b594e0fea2 - When adjusting the end of a partition to lie on a cylinder boundary, don't
adjust the size, but the actual end.
- Break out some of the sanity checks on partitions into a sanitize_partition
  function.
- When adjusting partitions, always adjust the start "up", and the end "down"
  so that we stay within the boundaries of the original request.
- Various small nits found by bde.

Reported by:	bde, imp, rgrimes
2000-08-24 17:54:45 +00:00
Josef Karthauser
197ef30718 0xA0 = Suspend to disk. 2000-08-07 00:26:09 +00:00
John Baldwin
fe81981fdb Fix a really stupid bug where I assumed sizeof(int) == 2. This resulted in
MBR's with a 4th slice failing the signature check and fdisk saying that
they are invalid.

Submitted by:	bde
2000-07-21 18:26:20 +00:00
John Baldwin
a12de06299 - Don't try to free mboot.bootinst before it has been allocated. If, for
some reason, mboot.bootinst is not initialized to NULL at the beginning
  of the program, then the last commit to this would try to free whatever
  bogus address is in it.
- Restore the behavior of free()'ing the mboot.bootinst buffer after we
  abuse it to determine the sector size of the disk (as clearly noted in
  the comments).  Properly fix the double free() bug by setting the pointer
  to NULL after we free it.
2000-07-17 19:51:42 +00:00
Andrey A. Chernov
2b5ce8a961 Fix memory leak/double free found by phkmalloc
Uniform mboot.bootinst allocation code to be independent of functions order
2000-07-15 13:37:47 +00:00
John Baldwin
85c2cf303d - Always respect cylinder boundaries when creating slices unless the user
explicitly sets the geometry.
- Allow for MBR boot loaders that are longer than one sector.  Only accept
  boot loaders if their size is a multiple of the sector size, however.
2000-07-12 16:45:11 +00:00
John Baldwin
ed1235ad70 Catch the usage() function up to the command line changes. Add -I and
remove -e.
2000-06-27 20:36:44 +00:00
Brian Somers
35bfe0c305 0x39 == plan9
Obtained from: OpenBSD
2000-06-12 09:08:40 +00:00
Guy Helmer
691e5f80b5 Add QNX 4 partitions to fdisk's list.
PR:		bin/8809
Submitted by:	"John C. Place" <jcplace@ibm.net>
Prompted by:	<nrahlstr@winternet.com>
2000-06-09 19:10:09 +00:00
Mike Smith
149938cc61 Don't try to open the /dev/rXXX device. 2000-05-31 00:58:55 +00:00
Warner Losh
10b0ee9392 -e -> -I change.
-s for sumary

Approved by:	jkh
2000-03-10 22:03:00 +00:00
David E. O'Brien
dc6bbfb6f8 Don't use the old raw name for disk devices. 2000-03-09 19:35:32 +00:00
Ruslan Ermilov
cb840fc730 Add ata(4) support.
Approved by:	jkh
2000-02-11 11:25:23 +00:00
Bill Fumerola
cefdc4ef10 Stuff a variable declaration inside a #if block that is only used for that
#if.
1999-09-25 02:11:30 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Doug White
f10f160d82 Add -e option to usage(). 1999-08-25 21:31:08 +00:00
Poul-Henning Kamp
e6fb3dde93 Add new option to fdisk: -e
This wipes the MBR and creates slice 1 as a FreeBSD slice covering the
disk starting from the second track to the cylinder aligned end of the disk.

This is the most compatibly layout we have as far as I know.
1999-08-23 11:06:19 +00:00
Robert Nordier
26721a89ff Drop the embedded boot code in favour of a -B option which reads
the boot code from /boot/mbr, or elsewhere as defined by the revised
"-b bootcode" option; use getopt(3); clarify usage(); partially
revise man page; etc.
1999-06-27 19:29:15 +00:00
Robert Nordier
12d910e9bb Add a -b option as a simple way to rewrite the mbr code
(eg. replacing a boot manager with a standard mbr)
1999-01-22 11:54:17 +00:00
Joerg Wunsch
698b4def3f sd0 -> da0 1998-11-26 12:24:35 +00:00
Alexander Langer
ef80de33ad Add an entry for the new NetBSD partition id. 1998-11-06 03:43:21 +00:00
Joseph Koshy
d1b7313fca Add an entry for BSD/OS [23].x partition types.
I don't have access to a BSD/OS machine to check the veracity of the
magic number.  However, no harm will be done by the commit and since
someone was motivated enough to file a PR, I'm committing the change.

PR:		7629
Submitted by:	Jos Backus <jbackus@plex.nl>
1998-11-06 03:25:56 +00:00
David E. O'Brien
63ab6f1c55 Linux swap and Solaris x86 use the same BIOS partition id. 1998-09-16 19:25:47 +00:00
Philippe Charnier
d98b16689b Correct use of .Nm, use .Bx Free for FreeBSD. Add rcsid, remove unused
#includes. Spelling. Use err(3) and add usage().
1998-07-06 06:44:36 +00:00
Bruce Evans
ba198492ad Fixed printf format errors. 1998-06-28 20:48:03 +00:00
James Raynard
4b3b45a7a2 Fix typo in prompt. 1998-05-20 22:23:16 +00:00
David E. O'Brien
680426be8f Add NTFS partition type.
Add "." at the end of some sentances.
Also print "flag 80" in English.
Give hint that "sysid" for FreeBSD is 165 decimal.
Ensure active partition specified by user is 1-4.
1998-03-29 23:41:51 +00:00