aboutsummaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/Makefile1
-rw-r--r--sbin/fdisk/fdisk.818
-rw-r--r--sbin/fdisk/fdisk.c14
-rw-r--r--sbin/fdisk/fdisk_mbr_enc.c1
4 files changed, 27 insertions, 7 deletions
diff --git a/sbin/fdisk/Makefile b/sbin/fdisk/Makefile
index 322dfa33043c..85cea684a883 100644
--- a/sbin/fdisk/Makefile
+++ b/sbin/fdisk/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE=runtime
PROG= fdisk
SRCS= fdisk.c fdisk_mbr_enc.c
diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8
index 3c6a73318271..09933acf57df 100644
--- a/sbin/fdisk/fdisk.8
+++ b/sbin/fdisk/fdisk.8
@@ -15,6 +15,22 @@
.Fl f Ar configfile
.Op Fl itv
.Op Ar disk
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and is not available in
+.Fx 15.0
+or later.
+Use
+.Xr gpart 8
+instead
+.Po
+with the
+.Cm MBR
+partitioning scheme
+.Pc ,
+or install the
+.Pa freebsd-fdisk
+port or package.
.Sh PROLOGUE
In order for the BIOS to boot the kernel,
certain conventions must be adhered to.
@@ -456,7 +472,7 @@ downwards to correspond to head and cylinder boundaries):
Example: to set slices 1, 2 and 4 to
.Fx
slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the
-forth being the remainder of the disk (again, numbers will be rounded
+fourth being the remainder of the disk (again, numbers will be rounded
appropriately):
.Pp
.Dl "p 1 165 63 2G"
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 6cfa2b510f22..925cc68932d7 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -265,6 +265,10 @@ main(int argc, char *argv[])
int partition = -1;
struct dos_partition *partp;
+ fprintf(stderr,
+ "WARNING: fdisk is deprecated and is not available in FreeBSD 15 or later.\n"
+ "Please use gpart instead.\n\n");
+
while ((c = getopt(argc, argv, "BIab:f:ipqstuv1234")) != -1)
switch (c) {
case 'B':
@@ -380,7 +384,8 @@ main(int argc, char *argv[])
printf("******* Working on device %s *******\n",disk);
if (I_flag) {
- read_s0();
+ if (read_s0())
+ warnx("Ignoring bad existing MBR.");
reset_boot();
partp = &mboot.parts[0];
partp->dp_typ = DOSPTYP_386BSD;
@@ -410,8 +415,10 @@ main(int argc, char *argv[])
else
print_params();
- if (read_s0())
+ if (read_s0()) {
+ printf("Will replace existing bad MBR\n");
init_sector0(dos_sectors);
+ }
printf("Media sector size is %d\n", secsize);
printf("Warning: BIOS sector numbering starts with sector 1\n");
@@ -1465,7 +1472,6 @@ sanitize_partition(struct dos_partition *partp)
* The following choices are considered:
* /dev/ad0s1a => /dev/ad0
* /dev/da0a => /dev/da0
- * /dev/vinum/root => /dev/vinum/root
* A ".eli" part is removed if it exists (see geli(8)).
* A ".journal" ending is removed if it exists (see gjournal(8)).
*/
@@ -1482,7 +1488,7 @@ get_rootdisk(void)
if (statfs("/", &rootfs) == -1)
err(1, "statfs(\"/\")");
- if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]*)([sp][0-9]+)?[a-h]?(\\.journal)?$",
+ if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\\.journal)?$",
REG_EXTENDED)) != 0)
errx(1, "regcomp() failed (%d)", rv);
strlcpy(dev, rootfs.f_mntfromname, sizeof (dev));
diff --git a/sbin/fdisk/fdisk_mbr_enc.c b/sbin/fdisk/fdisk_mbr_enc.c
index 6fe99bbba1b3..d621124c7a85 100644
--- a/sbin/fdisk/fdisk_mbr_enc.c
+++ b/sbin/fdisk/fdisk_mbr_enc.c
@@ -33,7 +33,6 @@
* NB! This file must be usable both in kernel and userland.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/diskmbr.h>
#include <sys/endian.h>