Bug 140437 - fdisk support for sector size > 512 for SGI labeled disk
fdisk support for sector size > 512 for SGI labeled disk
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: util-linux (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Ben Levenson
:
Depends On:
Blocks: 156322
  Show dependency treegraph
 
Reported: 2004-11-22 16:40 EST by Jean Blouin
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2005-669
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-05 12:49:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fdisk patch for Variable Block support of SGI volume headers (1.50 KB, patch)
2004-12-03 21:31 EST, Eric Y. Theriault
no flags Details | Diff

  None (edit)
Description Jean Blouin 2004-11-22 16:40:02 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686;
chrome://navigator/locale/navigator.properties; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Description of problem:
The problem description is that when you have a hardware RAID or a
disk drive that has a sector size different than 512 (blockdev --getss
device), the creation of SGI labeled disks incorrectly sets the device
characteristics, resulting in partitions that are at least 8 times the
size of the physical capacity.  Furthermore when the device is used in
IRIX's fx, the utility will indicate that the drive's physical sector
size does not match the volume header's sector size.

To reproduce the issue, use a disk drive with a 4096 sector size under
fdisk; remove the existing partitions (o), in the expert menu (x),
create an IRIX partition table (g),  after returning to the main menu
(r), create a new partition (n) number 8, using the default lengths. 
Save the changes via w.  Moving the device to an SGI workstation will
result in the aforementioned error.

The attached file is the patch thus far based on util-linux-2.12h, as
downloaded from Debian
(http://packages.debian.org/unstable/base/util-linux).



Version-Release number of selected component (if applicable):
util-linux-2.11y-31.

How reproducible:
Always

Steps to Reproduce:
1.use disk drive with 4096 sector size under fdisk
2.remove the existing partitions (o)
3.in the expert menu (x),
4.create an IRIX partition table (g),
5.after returning to the main menu (r),
6.create a new partition (n) number 8, using the default lengths.
7.Save the changes via w. 
8.Moving the device to an SGI workstation will result in the
aforementioned error.

    

Actual Results:  resulting in partitions that are at least 8 times the
size of the physical capacity. 

Expected Results:  resulting in partitions are of the correct size.

Additional info:

diff -Naur util-linux-2.12h.orig/fdisk/fdisksgilabel.c
util-linux-2.12h/fdisk/fdisksgilabel.c
--- util-linux-2.12h.orig/fdisk/fdisksgilabel.c	2004-09-06
16:44:56.000000000 -0400
+++ util-linux-2.12h/fdisk/fdisksgilabel.c	2004-11-19
17:00:01.000000000 -0500
@@ -201,19 +201,21 @@
 			 "%d cylinders, %d physical cylinders\n"
 			 "%d extra sects/cyl, interleave %d:1\n"
 			 "%s\n"
-			 "Units = %s of %d * 512 bytes\n\n"),
+			 "Units = %s of %d * %d bytes\n\n"),
 		       disk_device, heads, sectors, cylinders,
 		       SSWAP16(sgiparam.pcylcount),
 		       SSWAP16(sgiparam.sparecyl),
 		       SSWAP16(sgiparam.ilfact),
 		       (char *)sgilabel,
-		       str_units(PLURAL), units_per_sector);
+		       str_units(PLURAL), units_per_sector,
+		       sector_size);
 	} else {
 		printf(_("\nDisk %s (SGI disk label): "
 			 "%d heads, %d sectors, %d cylinders\n"
-			 "Units = %s of %d * 512 bytes\n\n"),
+			 "Units = %s of %d * %d bytes\n\n"),
 		       disk_device, heads, sectors, cylinders,
-		       str_units(PLURAL), units_per_sector);
+		       str_units(PLURAL), units_per_sector,
+		       sector_size);
 	}
 	printf(_("----- partitions -----\n"
 		 "Pt# %*s  Info     Start       End   Sectors  Id  System\n"),
@@ -698,9 +700,6 @@
 	int i=0;
 	unsigned long long llsectors;
 	int res; 		/* the result from the ioctl */
-	int sec_fac; 		/* the sector factor */
-
-	sec_fac = sector_size / 512;	/* determine the sector factor */
 
 	fprintf(stderr,
 		_("Building a new SGI disklabel. Changes will remain in memory only,\n"
@@ -717,7 +716,7 @@
 		if (res == 0) {
 			/* the get device size ioctl was successful */
 			unsigned long long llcyls;
-			llcyls = llsectors / (heads * sectors * sec_fac);
+			llcyls = llsectors / (heads * sectors);
 			cylinders = llcyls;
 			if (cylinders != llcyls)	/* truncated? */
 				cylinders = ~0;
@@ -768,7 +767,7 @@
 	sgilabel->devparam.unused1			= SSWAP16(0);
 	sgilabel->devparam.nsect			= SSWAP16(geometry.sectors);
 	/* sectors/track */
-	sgilabel->devparam.bytes			= SSWAP16(512);
+	sgilabel->devparam.bytes			= SSWAP16(sector_size);
 	sgilabel->devparam.ilfact			= SSWAP16(1);
 	sgilabel->devparam.flags			= SSWAP32(TRACK_FWD|\
 								  IGNORE_ERRORS|RESEEK);
Comment 1 Jean Blouin 2004-11-24 15:31:50 EST
Not fixing this bug won't allow our future customer to format there
drive with a sector size of 4k which impacts the performance of our
product. Could you set this bug to high priority.
Comment 2 Elliot Lee 2004-11-24 16:37:31 EST
For future reference, here was my reply to the original bug report:

This bug is about partitioning disks that are used in SGI
workstations. The bug does not affect the ability to use RHEL, just the
ability to use Irix. What that tells me is that this patch should go
upstream and be included in FC4 and RHEL5, but it doesn't seem critical
enough to justify putting the patch in a RHEL quarterly update.
Comment 3 Jean Blouin 2004-11-25 11:02:35 EST
Actually this bug impacts RHEL users of SGI formated disk in a Linux
system not only users SGI workstations.
Comment 4 Elliot Lee 2004-12-01 18:22:28 EST
Modified version of the patch put into CVS on the devel branch...
Comment 5 Eric Y. Theriault 2004-12-03 21:31:29 EST
Created attachment 107882 [details]
fdisk patch for Variable Block support of SGI volume headers

The change at line 716/717 should not be done.	To create a partition table on
the device, the base device (/dev/sda for example) should be used.  The initial
testing we had done on this was on SGI's volume partition (#10), in which case
this would be required, however, this prevents you from creating the partition
on a new disk.

As such, the final patch should be the attached version.  This partitions
created by the attached patch has been tested on both IRIX and Linux, and both
oeprating systems can properly use the devices.
Comment 6 Elliot Lee 2004-12-10 15:45:28 EST
Thanks for the update. I've put it into the CVS devel branch. Next
time please make sure to submit final versions of the patch - it saves
the upstream maintainer from having to get bad patches from me. :)
Comment 8 Karel Zak 2005-07-19 11:12:32 EDT
The patch missing in RHEL4. Already in RHEL3 and FC4.
Comment 14 Red Hat Bugzilla 2005-10-05 12:49:29 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-669.html

Note You need to log in before you can comment on or make changes to this bug.