summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/v2.18-ReleaseNotes6
-rw-r--r--fdisk/fdisk.845
-rw-r--r--fdisk/fdisk.c28
3 files changed, 52 insertions, 27 deletions
diff --git a/docs/v2.18-ReleaseNotes b/docs/v2.18-ReleaseNotes
index c208b303..6ac98f61 100644
--- a/docs/v2.18-ReleaseNotes
+++ b/docs/v2.18-ReleaseNotes
@@ -4,9 +4,9 @@ Util-linux-ng 2.18 Release Notes
The util-linux-ng package does not contain rdev(8), ramsize(8),
vidmode(8) and rootflags(8) anymore.
-The fdisk(8) command does not use DOS-compatible mode and cylinders as
-display units by default. The old deprecated DOS behavior could be enabled
-by 'c' and 'u' fdisk commands.
+The fdisk(8) command does not use DOS-compatible mode and cylinders as display
+units by default. The old deprecated DOS behavior could be enabled by 'c' and
+'u' fdisk commands or from command line by '-c=dos -u=cylinders' options.
Release highlights
------------------
diff --git a/fdisk/fdisk.8 b/fdisk/fdisk.8
index bd94a020..26a47d2a 100644
--- a/fdisk/fdisk.8
+++ b/fdisk/fdisk.8
@@ -28,6 +28,21 @@ fdisk \- Partition table manipulator for Linux
.sp
.B fdisk \-h
.SH DESCRIPTION
+.B fdisk
+(in the first form of invocation)
+is a menu driven program for creation and manipulation of
+partition tables.
+It understands DOS type partition tables and BSD or SUN type disklabels.
+
+.B fdisk
+does not understand GUID Partition Table (GPT) and
+it is not designed for large partitions. In particular case use more advanced GNU
+.BR parted (8).
+
+.B fdisk does not use DOS-compatible mode and cylinders
+as display units by default. The old deprecated DOS behavior could be
+enabled by '-cdos -ucyl' command line options.
+
Hard disks can be divided into one or more logical disks called
.IR partitions .
This division is described in the
@@ -50,17 +65,7 @@ so as to make sure that this stuff is accessible to the BIOS.
There may be reasons of security, ease of administration and backup,
or testing, to use more than the minimum number of partitions.
-.B fdisk
-(in the first form of invocation)
-is a menu driven program for creation and manipulation of
-partition tables.
-It understands DOS type partition tables and BSD or SUN type disklabels.
-
-.B fdisk
-doesn't understand GUID Partition Table (GPT) and
-it is not designed for large partitions. In particular case use more advanced GNU
-.BR parted (8).
-
+.SH DEVICES
The
.I device
is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk.
@@ -78,6 +83,7 @@ name followed by a partition number. For example,
is the first partition on the first hard disk in the system.
See also Linux kernel documentation (the Documentation/devices.txt file).
+.SH DISK LABELS
A BSD/SUN type disklabel can describe 8 partitions,
the third of which should be a `whole disk' partition.
Do not start a partition that actually uses its first sector
@@ -189,8 +195,12 @@ between logical and physical sector size. This option changes both sector sizes
.BI \-h
Print help and then exit.
.TP
-.BI \-c
-Switch off DOS-compatible mode. (Default)
+.BI "\-c"[=mode]
+Specifies the compatiblity mode, 'dos' or 'nondos' mode. The default is non-DOS
+compatibility mode. For backward compatibility the option is possible to use
+without <mode> argument, then the default is used. Note that the optional
+<mode> argument cannot be separated from the -c option by space, the correct
+form is for example '-c=dos'.
.TP
.BI "\-C " cyls
Specify the number of cylinders of the disk.
@@ -213,9 +223,12 @@ If no devices are given, those mentioned in
.I /proc/partitions
(if that exists) are used.
.TP
-.B \-u
-When listing partition tables, give sizes in sectors instead
-of cylinders. (Default)
+.BI "\-u"[=unit]
+When listing partition tables, give sizes in 'sectors' or in 'cylinders'. The
+default is to give sizes in sectors. For backward compatibility the option is
+possible to use without <units> argument, then the default is used. Note that
+the optional <unit> argument cannot be separated from the -u option by space,
+the correct form is for example '-u=cylinders'.
.TP
.BI "\-s " partition
The
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index f1392e7b..99b50aac 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -260,9 +260,9 @@ void fatal(enum failure why) {
" fdisk -s <partition> give partition size(s) in blocks\n"
"\nOptions:\n"
" -b <size> sector size (512, 1024, 2048 or 4096)\n"
-" -c switch off DOS-compatible mode (default)\n"
+" -c[=<mode>] compatible mode: 'dos' or 'nondos' (default)\n"
" -h print this help text\n"
-" -u show sizes in sectors instead of cylinders (default)\n"
+" -u[=<unit>] dysplay units: 'cylinders' or 'sectors' (default)\n"
" -v print program version\n"
" -C <number> specify the number of cylinders\n"
" -H <number> specify the number of heads\n"
@@ -1609,8 +1609,11 @@ void change_units(void)
{
display_in_cyl_units = !display_in_cyl_units;
update_units();
- printf(_("Changing display/entry units to %s\n"),
- str_units(PLURAL));
+
+ if (display_in_cyl_units)
+ printf(_("Changing display/entry units to cylinders (DEPRECATED!)\n"));
+ else
+ printf(_("Changing display/entry units to sectors\n"));
}
static void
@@ -1630,7 +1633,7 @@ static void
toggle_dos_compatibility_flag(void) {
dos_compatible_flag = ~dos_compatible_flag;
if (dos_compatible_flag)
- printf(_("DOS Compatibility flag is set\n"));
+ printf(_("DOS Compatibility flag is set (DEPRECATED!)\n"));
else
printf(_("DOS Compatibility flag is not set\n"));
@@ -2919,7 +2922,7 @@ main(int argc, char **argv) {
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- while ((c = getopt(argc, argv, "b:cC:hH:lsS:uvV")) != -1) {
+ while ((c = getopt(argc, argv, "b:c::C:hH:lsS:u::vV")) != -1) {
switch (c) {
case 'b':
/* Ugly: this sector size is really per device,
@@ -2937,7 +2940,12 @@ main(int argc, char **argv) {
user_cylinders = atoi(optarg);
break;
case 'c':
- dos_compatible_flag = 0;
+ dos_compatible_flag = 0; /* default */
+
+ if (optarg && !strcmp(optarg, "=dos"))
+ dos_compatible_flag = ~0;
+ else if (optarg && strcmp(optarg, "=nondos"))
+ fatal(usage);
break;
case 'h':
fatal(help);
@@ -2959,7 +2967,11 @@ main(int argc, char **argv) {
opts = 1;
break;
case 'u':
- display_in_cyl_units = 0;
+ display_in_cyl_units = 0; /* default */
+ if (optarg && strcmp(optarg, "=cylinders") == 0)
+ display_in_cyl_units = !display_in_cyl_units;
+ else if (optarg && strcmp(optarg, "=sectors"))
+ fatal(usage);
break;
case 'V':
case 'v':