diff -Naur util-linux-ng-2.13/fdisk/fdisk.c util-linux-ng-2.13-korg/fdisk/fdisk.c
--- util-linux-ng-2.13/fdisk/fdisk.c	2007-08-13 19:39:46.000000000 +0900
+++ util-linux-ng-2.13-korg/fdisk/fdisk.c	2020-12-15 12:19:58.000000000 +0900
@@ -8,6 +8,8 @@
  * (at your option) any later version.
  */
 
+#define X09130_PARTITIONER	1
+
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -209,6 +211,7 @@
 	sector_size = DEFAULT_SECTOR_SIZE,
 	user_set_sector_size = 0,
 	units_per_sector = 1,
+	cylinder_size = 1,
 	display_in_cyl_units = 1;
 
 unsigned long long total_number_of_sectors;
@@ -728,7 +731,9 @@
 						  "data in partition table"
 						  " %d\n"), partitions + 1);
 				else
+				{
 					pe->part_table = p;
+				}
 			}
 		}
 
@@ -945,6 +950,8 @@
 	if (!cylinders)
 		cylinders = user_cylinders;
 
+	cylinder_size = (sectors * heads * sector_size);
+
 	if (g) {
 		g->heads = heads;
 		g->sectors = sectors;
@@ -1984,6 +1991,133 @@
 		       total_number_of_sectors - total);
 }
 
+#if X09130_PARTITIONER
+static void
+my_add_partition(int n, int startCyl, int stopCyl, int sys) {
+	char mesg[256];		/* 48 does not suffice in Japanese */
+	int i, read = 0;
+	struct partition *p = ptes[n].part_table;
+	struct partition *q = ptes[ext_index].part_table;
+	long long llimit;
+	unsigned long long start, stop = 0, limit, temp,
+		first[partitions], last[partitions];
+
+	if (p && p->sys_ind) {
+		printf(_("Partition %d is already defined.  Delete "
+			 "it before re-adding it.\n"), n + 1);
+		return;
+	}
+	fill_bounds(first, last);
+	if (n < 4) {
+		start = sector_offset;
+		if (display_in_cyl_units || !total_number_of_sectors)
+			llimit = heads * sectors * cylinders - 1;
+		else
+			llimit = total_number_of_sectors - 1;
+		limit = llimit;
+		if (limit != llimit)
+			limit = 0x7fffffff;
+		if (extended_offset) {
+			first[ext_index] = extended_offset;
+			last[ext_index] = get_start_sect(q) +
+				get_nr_sects(q) - 1;
+		}
+	} else {
+		start = extended_offset + sector_offset;
+		limit = get_start_sect(q) + get_nr_sects(q) - 1;
+	}
+	if (display_in_cyl_units)
+		for (i = 0; i < partitions; i++)
+			first[i] = (cround(first[i]) - 1) * units_per_sector;
+
+	snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
+	do {
+		temp = start;
+		for (i = 0; i < partitions; i++) {
+			int lastplusoff;
+
+			if (start == ptes[i].offset)
+				start += sector_offset;
+			lastplusoff = last[i] + ((n<4) ? 0 : sector_offset);
+			if (start >= first[i] && start <= lastplusoff)
+				start = lastplusoff + 1;
+		}
+		if (start > limit)
+			break;
+		if (start >= temp+units_per_sector && read) {
+			printf(_("Sector %llu is already allocated\n"), temp);
+			temp = start;
+			read = 0;
+		}
+		if (!read && start == temp) {
+
+			start = startCyl;
+
+			if (display_in_cyl_units) {
+				start = (start - 1) * units_per_sector;
+				if (start < i) start = i;
+			}
+			read = 1;
+		}
+	} while (start != temp || !read);
+	if (n > 4) {			/* NOT for fifth partition */
+		struct pte *pe = &ptes[n];
+
+		pe->offset = start - sector_offset;
+		if (pe->offset == extended_offset) { /* must be corrected */
+			pe->offset++;
+			if (sector_offset == 1)
+				start++;
+		}
+	}
+
+	for (i = 0; i < partitions; i++) {
+		struct pte *pe = &ptes[i];
+
+		if (start < pe->offset && limit >= pe->offset)
+			limit = pe->offset - 1;
+		if (start < first[i] && limit >= first[i])
+			limit = first[i] - 1;
+	}
+	if (start > limit) {
+		printf(_("No free sectors available\n"));
+		if (n > 4)
+			partitions--;
+		return;
+	}
+	if (cround(start) == cround(limit)) {
+		stop = limit;
+	} else {
+		stop = stopCyl;
+
+		if (display_in_cyl_units) {
+			stop = stop * units_per_sector - 1;
+			if (stop >limit)
+				stop = limit;
+		}
+	}
+
+	set_partition(n, 0, start, stop, sys);
+	if (n > 4)
+		set_partition(n - 1, 1, ptes[n].offset, stop, EXTENDED);
+
+	if (IS_EXTENDED (sys)) {
+		struct pte *pe4 = &ptes[4];
+		struct pte *pen = &ptes[n];
+
+		ext_index = n;
+		pen->ext_pointer = p;
+		pe4->offset = extended_offset = start;
+		if (!(pe4->sectorbuffer = calloc(1, sector_size)))
+			fatal(out_of_memory);
+		pe4->part_table = pt_offset(pe4->sectorbuffer, 0);
+		pe4->ext_pointer = pe4->part_table + 1;
+		pe4->changed = 1;
+		partitions = 5;
+	}
+}
+#endif
+
 static void
 add_partition(int n, int sys) {
 	char mesg[256];		/* 48 does not suffice in Japanese */
@@ -2113,6 +2247,25 @@
 	}
 }
 
+#if X09130_PARTITIONER
+static void
+my_add_logical(int partitionNumber, int startCyl, int stopCyl) 
+{
+	if (partitions > 5 || ptes[4].part_table->sys_ind) {
+		struct pte *pe = &ptes[partitions];
+
+		if (!(pe->sectorbuffer = calloc(1, sector_size)))
+			fatal(out_of_memory);
+		pe->part_table = pt_offset(pe->sectorbuffer, 0);
+		pe->ext_pointer = pe->part_table + 1;
+		pe->offset = 0;
+		pe->changed = 1;
+		partitions++;
+	}
+	my_add_partition(partitionNumber, startCyl, stopCyl, LINUX_NATIVE);
+}
+#endif
+
 static void
 add_logical(void) {
 	if (partitions > 5 || ptes[4].part_table->sys_ind) {
@@ -2564,6 +2717,15 @@
 main(int argc, char **argv) {
 	int j, c;
 	int optl = 0, opts = 0;
+#if X09130_PARTITIONER
+	int x091302ndDisk = 0;
+	int x09130VTDisk = 0;
+	int x01930BootCylinders = 0;
+	int x01930RootCylinders = 0;
+	int x01930SwapCylinders = 0;
+	int x01930ROCylinders = 0;
+	int x01930VTBootCylinders = 0;
+#endif
 
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -2579,7 +2741,12 @@
 	 * Options -C, -H, -S set the geometry.
 	 * 
 	 */
+#if X09130_PARTITIONER
+	// add a -X argument that is used to specify that a 2nd internal X09130 disk is being targeted.
+	while ((c = getopt(argc, argv, "b:C:H:lsS:uvV:XT")) != -1) {
+#else
 	while ((c = getopt(argc, argv, "b:C:H:lsS:uvV")) != -1) {
+#endif
 		switch (c) {
 		case 'b':
 			/* Ugly: this sector size is really per device,
@@ -2619,6 +2786,14 @@
 		case 'v':
 			printf("fdisk (%s)\n", PACKAGE_STRING);
 			exit(0);
+#if X09130_PARTITIONER
+		case 'X':
+			x091302ndDisk = 1;
+			break;
+		case 'T':
+			x09130VTDisk = 1;
+			break;
+#endif
 		default:
 			fatal(usage);
 		}
@@ -2698,6 +2873,45 @@
 		/* If we return we may want to make an empty DOS label? */
 	}
 
+#if X09130_PARTITIONER
+	delete_partition(0);	// create /dev/sdx1
+	delete_partition(1);	// create /dev/sdx2
+	delete_partition(2);
+	delete_partition(3);
+
+	// calculate partition sizes needed in terms of cylinders:
+	x01930BootCylinders = 16 * 1024 * 1024 / cylinder_size;
+	x01930RootCylinders = 2000 * 1024 * 1024 / cylinder_size;
+	x01930SwapCylinders = 503 * 1024 * 1024 / cylinder_size;
+	x01930ROCylinders = 526 * 1024 * 1024 / cylinder_size;
+	x01930VTBootCylinders = 79 * 1024 * 1024 / cylinder_size;
+
+	if (x091302ndDisk)
+	{
+		my_add_partition(0, 1, cylinders, LINUX_NATIVE);		// create /dev/sdx1
+	}
+	else if (x09130VTDisk)
+	{
+		my_add_partition(0, 1, x01930VTBootCylinders, LINUX_NATIVE);		// create /dev/sdx1
+		my_add_partition(1, 11, (cylinders-(x01930SwapCylinders+1)), LINUX_NATIVE);		// create /dev/sdx2
+		my_add_partition(2, (cylinders-x01930SwapCylinders), cylinders, LINUX_SWAP);		// create /dev/sdx3	(linux swap)
+		toggle_active(0);								// set /dev/sdx1 bootable
+	}
+	else
+	{
+		my_add_partition(0, 1, x01930BootCylinders, LINUX_NATIVE);		// create /dev/sdx1
+		my_add_partition(1, (x01930BootCylinders+1), (x01930BootCylinders+x01930RootCylinders), LINUX_NATIVE);		// create /dev/sdx2
+		my_add_partition(2, (x01930BootCylinders+x01930RootCylinders+1), (x01930BootCylinders+x01930RootCylinders+x01930SwapCylinders), LINUX_SWAP);	// create /dev/sdx3	(linux swap)
+		my_add_partition(3, (x01930BootCylinders+x01930RootCylinders+x01930SwapCylinders+1), cylinders, EXTENDED);	// create /dev/sdx4	(extended partition)
+		my_add_logical(4, (x01930BootCylinders+x01930RootCylinders+x01930SwapCylinders+1), (x01930BootCylinders+x01930RootCylinders+x01930SwapCylinders+x01930ROCylinders));	// create /dev/sdx5
+		my_add_logical(5, (x01930BootCylinders+x01930RootCylinders+x01930SwapCylinders+x01930ROCylinders+1), cylinders);		// create /dev/sdx6
+		toggle_active(0);								// set /dev/sdx1 bootable
+	}
+
+	write_table();
+	exit(0);
+#endif
+
 	while (1) {
 		putchar('\n');
 		c = tolower(read_char(_("Command (m for help): ")));
