Bug 140437 - fdisk support for sector size > 512 for SGI labeled disk
Summary: fdisk support for sector size > 512 for SGI labeled disk
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: util-linux
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks: 156322
TreeView+ depends on / blocked
 
Reported: 2004-11-22 21:40 UTC by Jean Blouin
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHBA-2005-669
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-05 16:49:29 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:669 0 qe-ready SHIPPED_LIVE util-linux bug fix update 2005-10-05 04:00:00 UTC

Description Jean Blouin 2004-11-22 21:40:02 UTC
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 20:31:50 UTC
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 21:37:31 UTC
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 16:02:35 UTC
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 23:22:28 UTC
Modified version of the patch put into CVS on the devel branch...

Comment 5 Eric Y. Theriault 2004-12-04 02:31:29 UTC
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 20:45:28 UTC
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 15:12:32 UTC
The patch missing in RHEL4. Already in RHEL3 and FC4.

Comment 14 Red Hat Bugzilla 2005-10-05 16:49:29 UTC
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.