summaryrefslogtreecommitdiffstats
path: root/sbin/fdisk/fdisk.c
Commit message (Collapse)AuthorAgeFilesLines
* VMware environment is frequent nowadays. Add VMFS id.marck2012-04-161-0/+1
| | | | MFC after: 2 weeks
* Fix multi-line comment formatting.ae2011-11-071-2/+4
| | | | | Pointed by: jh MFC after: 1 week
* Improve error reporting when MBR can not be written.ae2011-11-071-36/+62
| | | | | | | | | Remove obsolete code which uses DIOCSMBR ioctl. When writing MBR first check that GEOM_MBR is available, if it is not available, then try write MBR directly to provider. If both are failed, then recommend to use gpart(8). MFC after: 2 week
* Initialize "acc" value inside the loop to reset failed attempts.ae2011-11-061-2/+2
| | | | | PR: misc/162262 MFC after: 3 days
* Add missing static keywords for global variables to tools in sbin/.ed2011-11-041-1/+1
| | | | | | These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file.
* remove trailing whitespace...jmg2011-10-291-3/+3
| | | | MFC after: 1 week
* error if /boot/mbr is empty... This can happen on a system like armjmg2011-10-291-0/+2
| | | | | | | that doesn't have a /boot/mbr, and you touch it to get past the previous error message... MFC after: 1 week
* The decimal() function was changed in r217808 to take theae2011-08-191-1/+1
| | | | | | | | | | maximum value instead of number of bits. But for case when limitation is not needed it erroneously skips conversion to number and always returns zero. So, don't skip conversion for case when limitation is not needed. PR: bin/159765 Approved by: re (kib)
* The MBR uses a 32-bit unsigned integer to store the size of a slice, butrstone2011-07-171-4/+4
| | | | | | | | | | | | | | | | fdisk(1) internally uses a signed int. Should a user attempt to specify a slice containing more than 2^31 - 1 sectors, an error will be reported on systems with sizeof(long) == 4 and the slice size will be silently truncated on systems with sizeof(long) > 4. Instead use an unsigned long to store the slice size in fdisk(1). This allows the user to specify a slice size up to the maximum permitted by the MBR on-disk format and does not have any problems with silent truncation should the use specify an slice size larger than 2^32 on systems with sizeof(long) > 4. Submitted by: Mark Johnston (markjdb AT gmail DOT com) MFC after: 2 weeks
* Supply maximum value as an argument to the decimal() functionsobomax2011-01-251-27/+27
| | | | | | instead of supplying number of bits. Submitted by: bde
* o Cylinder numbers are 10 bits in the MBR;sobomax2011-01-241-19/+19
| | | | | | | | o Sector numbers are only 6 bits in the MBR; o bde'cize name of the local variable. Submitted by: bde
* Warn user when value entered is greated than the amount supportedsobomax2011-01-221-20/+31
| | | | | | | | | | | by the MBR for the given parameter and set that parameter to the maximum value instead of just truncating the most significant part silently. Could happen for example if the capacity of the device is more than 2TB, so that the number of sectors is greater than 2Mib. MFC after: 1 month
* Add support for identifying a journaled root filesystem.brian2010-09-161-1/+2
| | | | | | Fix support for identifying the given /dev/vinum/root example. MFC after: 3 weeks
* Handle geli-encrypted root disk devices.brian2010-09-061-2/+7
| | | | MFC after: 2 weeks
* - Back out the previous change in order to maintain compatibility.lulf2009-06-171-2/+2
|
* - The maximum number of heads is 255, not 256.lulf2009-06-151-2/+2
| | | | Pointed out by: marcel
* Enhance the 'p' command so that it understands size qualifiers (K/M/G) andbrian2009-05-251-6/+82
| | | | | | | | so that it understands '*' as 'DTRT'. PR: 68312 Submitted by: Rene de Vries - rene at tunix dot nl (mostly) MFC after: 3 weeks
* Reword some entries for NTFS and DOS.luigi2009-01-141-2/+4
| | | | | | Add entries for DELL and ASUS recovery partitions. MFC after: 3 days
* Another change from Christoph:luigi2009-01-141-110/+101
| | | | | | | | | | replace the table of partition with a simpler and faster array of strings. The change in the array is done mechanically, using vi commands. Most entries in the table are probably 15+ years old and largely outdated, so the next step is to remove stale entries with more current values. Submitted by: Christoph Mallon, with small changes from me MFC after: 3 days
* more changes from Christoph:luigi2009-01-141-15/+14
| | | | | | | | pass a pointer instead of an index to print_part() so it does not depend on a static variable. Submitted by: Christoph Mallon MFC after: 3 days
* remove unused argument to print_s0()luigi2009-01-141-11/+8
| | | | | Submitted by: Christoph Mallon MFC after: 3 days
* Some small fixes submitted by Christoph Mallon, specifically:luigi2009-01-131-17/+16
| | | | | | | | | | | | | + Remove a dead field of a struct. It serves no purpose anymore. + Remove a \n at the end of the format string of err(); the err() function already adds a \n ; + remove many unnecessary casts which obfuscate the code. This file has a huge number of indentation bugs, but I'd rather fix them when/if we happen to modify the relevant parts of the code. Submitted by: Christoph Mallon MFC after: 3 days
* - Improve error message given on g_providername call failure.lulf2008-09-301-1/+1
| | | | | | - While there, make error messages consistent with the rest. Approved by: kib (mentor)
* - Make use of the new and g_device_path utility function in libgeom to avoidlulf2008-09-071-49/+30
| | | | | | | | | duplication of code in fdisk and boot0cfg. Also make use of g_providername to fix an issue with fdisk and boot0cfg not using the correct provider when writing the MBR. Reviewed by: phk Approved by: pjd (mentor)
* Add a -q[uiet] flag for scripts.obrien2008-07-311-3/+8
|
* Add Apple HFS+ (0xAF) MBR partition type identificator.andre2007-05-061-0/+1
| | | | Submitted by: rpaulo (SoC2007 student)
* o Add -p flag: print a slice table in fdisk configuration file format.maxim2007-04-301-2/+28
| | | | | | | | Now it is possible to do something like fdisk -p ad0 | fdisk -f - ad1. PR: bin/110182 Submitted by: Jukka A. Ukkonen MFC after: 1 month
* - Fail with an understandable error message if we cannot detect thesimon2006-06-181-2/+5
| | | | | | | | | | | | | | | | sector size, instead of later failing with an error about /boot/mbr not being a multiple of the sector size (since we end up with an assumed sector size of MAX_SEC_SIZE * 2). - We query the sector size via an IOCTL anyway, so if that succeeds use that instead of probing for it via read(2) calls. This fixes the problem with fdisk failing to operate on at least graid3 and md(4) devices on kernels with src/sys/geom/geom_dev.c before rev. 1.90, due to fdisk failing to detect the sector size. - When detecting the root device allow "/" characters in it, which happens with e.g. gmirror devices. Reviewed by: cperciva MFC after: 1 week
* Call gctl_free() to free resource allocated with gctl_get_handle().rodrigc2005-09-171-1/+4
| | | | | | PR: bin/84664 Submitted by: Daan Vreeken <Danovitsch at Vitsch dot net> MFC after: 3 days
* Attempt gctl verb "write MBR" when updating.phk2005-07-151-28/+43
| | | | This should solve the problem of modifying a busy MBR.
* cosmetic changes.nyan2005-05-011-17/+15
|
* Use NDOSPART macro instead of a magic number.nyan2005-05-011-2/+2
|
* If we resort to opening a slice instead of the base device, do so withphk2005-04-291-1/+1
| | | | the correct mode for our arguments.
* Add 0xbf as new partition id for Solaris.phk2004-11-101-0/+1
| | | | Submitted by: Lawrence.Lee@sun.com
* Don't prepend "/dev" if an argument given is an absolute pathname.ru2004-10-201-1/+1
| | | | Reviewed by: jhb
* Make fdisk initialize the first instead of the last slice by default.phk2004-06-141-3/+3
|
* Add the Solaris x86 boot partition type. This is used in Solaris 10harti2003-12-181-0/+1
| | | | | | (and perhaps earlier). Submitted by: Joerg Schilling <schilling@fokus.fraunhofer.de>
* Warn about partitions that would overlap with the master boot record, anddes2003-11-131-0/+5
| | | | | | if the user agrees, move them out one track. MFC after: 7 days
* Use __FBSDID() to quiet GCC 3.3 warnings.obrien2003-05-031-4/+2
|
* Use symbolic constants from <sys/diskmbr.h> instead of local constants.phk2003-04-131-13/+15
| | | | | | | | | | | | | | | | | | Always set the magic sequence when we write, rather than trusting the previously read boot code to do so. Use explicit encoding/decoding of little endian disk image. Remove a comment which was OBE. Change the test vector for "fdisk -I" to reflect that there is a magic sequence in the result now. Add test case for "fdisk" which reads the image back. At least for the two test-cases this program now gives the same result on sparc64 as on i386. The lack of an installed /boot/mbr on sparc64 raises an (un)interesting question.
* Use default geometry in case the device doesn't provide one:phk2003-03-291-1/+6
| | | | | | | 512 for sectorsize. 63 for sectors. 255 for heads. This will mostly show up on MD(4) devices.
* Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/schweikh2002-12-301-2/+2
| | | | Add FreeBSD Id tag where missing.
* Make fdisk work on active GEOM devices.phk2002-12-291-8/+33
|
* Fix the regexp evilness so that fdisk can (again?) find the devicephk2002-10-271-1/+1
| | | | | | root is on from the root mount path. Spotted by: imp
* Don't attempt to find the geometry with disklabel based ioctl, it justphk2002-10-271-15/+0
| | | | issues a useless warning now.
* Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:phk2002-10-011-0/+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.
* Straighten out get_params().phk2002-09-201-33/+34
| | | | Sponsored by: DARPA & NAI Labs.
* Try to pick up disk geometry with specific DIOC* ioctls, rather thanphk2002-09-151-1/+21
| | | | | | expecting a bogo-disklabel to contain them, if possible. This makes fdisk work with GEOM.
* s/filesystem/file system/g as discussed on -developerstrhodes2002-08-211-6/+6
|
* Fixed some print format errors. Avoid some warnings about possiblebde2002-07-161-4/+5
| | | | | | (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.
OpenPOWER on IntegriCloud